wlschmidt / lcdmiscellany

Automatically exported from code.google.com/p/lcdmiscellany
1 stars 1 forks source link

Mpc Status.html decoding #21

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Hello,

Believe it or not I am still using your application:)
MPC has updated and the status.html page has changed, therefor the string 
decoding is wrong.

Could you please give a helping hand as I am not a programmer and i cant figure 
it out?

the current status.html looks like 

OnStatus("04 Strawberry Swing.mp3", "Playing", 21123, "00:00:21", 257780, 
"00:04:17", 0, 100, "D:\Desktop\04 Strawberry Swing.mp3")

were the old was like

OnStatus('Oceans Twelve.avi - Media Player Classic - v1.3.1249.0', 'Playing', 
5148, '00:00:05', 7210079, '02:00:10', 0, 100)

Original issue reported on code.google.com by yian...@gmail.com on 22 Feb 2014 at 5:34

GoogleCodeExporter commented 8 years ago
In include/Multimedia/mpc.c, there's a line with:

!IsList($vals = RegExp($status, "^OnStatus\('(.*?) - Media Player 
Classic[^']*', '([^',]*)', (#*), '[^']*', (#*), '[^']*', (#*), (#*)\)$"))

I believe you can just replace that with:

!IsList($vals = RegExp($status, "^OnStatus\(\"(.*?) - Media Player 
Classic[^\"]*\", \"([^\",]*)\", (#*), \"[^\"]*\", (#*), \"[^\"]*\", (#*), (#*), 
\"[^\"]*\"\)$"))

Aren't regular expressions lovely?

Original comment by mattme...@gmail.com on 22 Feb 2014 at 8:30

GoogleCodeExporter commented 8 years ago
i get 

Lex error, line 70: Invalid character
            (!IsList($vals = RegExp($status, "^OnStatus\(\"(.*?) - Media Player Classic[^\"]*\", \"([^\",]*)\", (#*), \"[^\"]*\", (#*), \"[^\"]*\", (#*), (#*), \"[^\"]*\"\)$")) &&
                                                              ^
Lex error, line 70: Invalid character
            (!IsList($vals = RegExp($status, "^OnStatus\(\"(.*?) - Media Player Classic[^\"]*\", \"([^\",]*)\", (#*), \"[^\"]*\", (#*), \"[^\"]*\", (#*), (#*), \"[^\"]*\"\)$")) &&
                                                                                         ^
Lex error, line 70: Invalid character
            (!IsList($vals = RegExp($status, "^OnStatus\(\"(.*?) - Media Player Classic[^\"]*\", \"([^\",]*)\", (#*), \"[^\"]*\", (#*), \"[^\"]*\", (#*), (#*), \"[^\"]*\"\)$")) &&
                                                                                                 ^
Lex error, line 70: Preprocessor instruction must occur on its own line
            (!IsList($vals = RegExp($status, "^OnStatus\(\"(.*?) - Media Player Classic[^\"]*\", \"([^\",]*)\", (#*), \"[^\"]*\", (#*), \"[^\"]*\", (#*), (#*), \"[^\"]*\"\)$")) &&
                                                                                                                                                                                   ^

any idea why?

Original comment by yian...@gmail.com on 22 Feb 2014 at 11:02

GoogleCodeExporter commented 8 years ago
I'm not sure.  It's been a while...  You could try replacing the \" with \\\"

Original comment by mattme...@gmail.com on 22 Feb 2014 at 11:14

GoogleCodeExporter commented 8 years ago
"the" == "all the"

Original comment by mattme...@gmail.com on 22 Feb 2014 at 11:14

GoogleCodeExporter commented 8 years ago
Wait...Maybe I used "|" as an escape character?  Try replacing the \" with |", 
and see if that works.

Original comment by mattme...@gmail.com on 22 Feb 2014 at 11:28

GoogleCodeExporter commented 8 years ago
found it :)

(!IsList($vals = RegExp($status, "^OnStatus\(|"([^|",]*)|", |"([^|",]*)|", 
(#*), |"[^|"]*|", (#*), |"[^|"]*|", (#*), (#*), |"[^|"]*|"\)$"))

Original comment by yian...@gmail.com on 22 Feb 2014 at 11:38

GoogleCodeExporter commented 8 years ago
As it turns out am the works programmer ever... 

vlc also changed, it now looks like the attached xml

i tried %title = RegExp($xml, "<info name=|"title|">(.*?)</info>")[0][0];

but it does not work, any idea why?

Original comment by yian...@gmail.com on 23 Feb 2014 at 6:12

Attachments:

GoogleCodeExporter commented 8 years ago
I've been updating my lcdmiscellany to work and noticed this problem also.
I tried as many escape sequences as I could think of but none worked. (\ \\ \\\ 
| etc).

So instead I just tweaked it so it doesn't have any quotes. Also a lot of my 
things tend to not have official titles so if there is no title, it uses the 
filename instead.

%title = RegExp($xml, "<info name=.title.>(.*?)</info>")[0][0];
if (%title ==s ""){
      %title = RegExp($xml, "<info name=.filename.>(.*?)</info>")[0][0];
}
%artist = RegExp($xml, "<info name=.artist.>(.*?)</info>")[0][0];
%year = RegExp($xml, "<info name=.date.>(.*?)</info>")[0][0];

Also for anyone else, VLC was updated and requires a password for http access. 
Go into Preferences> All> Interface> Main interfaces> Lua HTTP> set a password.
Then in your "LCDMisc.ini" do
vlc = http://:yourpassword@127.0.0.1:8080/requests/

Original comment by Chrismil...@gmail.com on 15 May 2014 at 2:30