Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6157537
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:48:11+00:00 2026-05-23T20:48:11+00:00

I’m currently developing a webinterface for XBMC witch contains ajax. Due the limitations of

  • 0

I’m currently developing a webinterface for XBMC witch contains ajax.
Due the limitations of the out ajax i was forced to make use of the local resources, instead of my ajax class, that normally generates the output.
I have a string.
The * means, this text can change.

This is the string:

Filename:smb://SERVER/Music/3 Doors Down/2000 The Better
Life/07 Better Life.mp3 PlayStatus:Playing SongNo:6 Type:Audio
Title:Better Life Track:7 Artist:3 Doors Down Album:The Better Life
Genre:Alternative Year:2000 URL:smb://xbox:xbox@SERVER/Music/3 Doors
Down/2000 The Better Life/07 Better Life.mp3 Lyrics: Bitrate:193
Samplerate:44 Thumb:DefaultAlbumCover.png Time:02:05 Duration:03:07
Percentage:66 File size:4509417 Changed:False

I want to know how i can match the Title, Arist, Time and Duration.
I tried with regex, but no success, because i don’t have so much JS knowledge.

Thanks,
Brantje

EDIT:
“Are you sure that’s the string? All run together like that with no newlines? Edit: I edited the question to fix the formatting. – Ariel 2 hours ago”

Nope,
The output from http://xbox/xbmcCmds/xbmcHttp?command=GetCurrentlyPlaying
Looks like this when playing a video

HTML code:

<html> 
<li>Filename:smb://SERVER/Movies/Drive Angry/Drive Angry (2011) DVDRip XviD-MAXSPEED.avi
<li>PlayStatus:Playing
<li>VideoNo:0
<li>Type:Video
<li>Thumb:DefaultVideoCover.png
<li>Time:00:00:28
<li>Duration:01:44:31
<li>Percentage:0
<li>File size:1666804442
<li>Changed:False</html> 

When playing music its abit different.

<html> 
<li>Filename:smb://SERVER/Music/3 Doors Down/2000 The Better Life/01 Kryptonite.mp3
<li>PlayStatus:Playing
<li>SongNo:-1
<li>Type:Audio
<li>Title:Kryptonite
<li>Track:1
<li>Artist:3 Doors Down
<li>Album:The Better Life
<li>Genre:Alternative
<li>Year:2000
<li>URL:smb://xbox:xbox@SERVER/Music/3 Doors Down/2000 The Better Life/01 Kryptonite.mp3
<li>Lyrics:
<li>Bitrate:192
<li>Samplerate:44
<li>Thumb:DefaultAlbumCover.png
<li>Time:00:05
<li>Duration:03:54
<li>Percentage:2
<li>File size:5618471
<li>Changed:False</html> 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T20:48:12+00:00Added an answer on May 23, 2026 at 8:48 pm

    Assuming the following string:

    var str = "Filename:smb://SERVER/Music/3 Doors Down/2000 The Better Life/07 Better Life.mp3 PlayStatus:Playing SongNo:6 Type:Audio Title:Better Life Track:7 Artist:3 Doors Down Album:The Better Life Genre:Alternative Year:2000 URL:smb://xbox:xbox@SERVER/Music/3 Doors Down/2000 The Better Life/07 Better Life.mp3 Lyrics: Bitrate:193 Samplerate:44 Thumb:DefaultAlbumCover.png Time:02:05 Duration:03:07 Percentage:66 File size:4509417 Changed:False";
    

    Extract the properties into a dictionary/map:

    var dict = (" " + str).split(/ (\w+):/).reduce(function(acc, el, i, orig) {
        if (i % 2)
            acc[el] = orig[i + 1];
        return acc;
    }, {});
    

    Here’s the same thing without a higher-order function:

    var i, dict = {}, pair = (" " + str).split(/ (\w+):/);
    for (i = 1; i < pair.length; i += 2)
        dict[pair[i]] = pair[i + 1];
    

    Retrieving values is now trivial:

    console.log(dict["Title"]);
    console.log(dict["Artist"]);
    console.log(dict["Time"]);
    console.log(dict["Duration"]);
    

    Output:

    Better Life
    3 Doors Down
    02:05
    03:07
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want use html5's new tag to play a wav file (currently only supported
I am currently running into a problem where an element is coming back from
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I have a JSP page retrieving data and when single or double quotes are
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
this is what i have right now Drawing an RSS feed into the php,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.