Skip to content
This repository has been archived by the owner on Oct 3, 2024. It is now read-only.

Parsing Problem with m3u_importer #1

Closed
rgmcleod52 opened this issue Mar 29, 2023 · 12 comments
Closed

Parsing Problem with m3u_importer #1

rgmcleod52 opened this issue Mar 29, 2023 · 12 comments

Comments

@rgmcleod52
Copy link

Skip,

I was happy to find that you’ve created a plugin to convert m3u playlists to the Volumio format.

However, I have not been successful in getting the plugin to work.
Golden Oldies.txt

I am running a RaspberryPi 3 based system running Volumio 3.435.

The playlists are extended m3u playlists that come from my Android phone or tablet. The first couple of lines of the test playlist I’ve tried look like this:

[Something was messing up the text since there were not three periods, only two. Here is a pasted version of the first three lines of the file directly from the editor. I have also attached the original file as a .txt file]
#EXTM3U
../../../2CB2-D47E/Music/If You Can Believe Your Eyes And Ears/07 California Dreamin.mp3
../../../2CB2-D47E/Music/Good Vibrations 40th Anniversary/01 Good Vibrations.mp3

My Volumio music resides on a NAS storage unit that is mounted on “McLeodOMV” (I’m running Open Media Vault).

I installed the plugin using your manual install instructions and that worked fine. I put the playlist in /data/INTERNAL on my Volumio and entered “INTERNAL/Golden Oldies.m3u” in the Settings page of the plugin. When I click on the Import button, it says it has successfully imported the playlist.

But when I look at the /tmp/m3u_importer.log file I see this: [This pasted set of text also showed the same error showing three periods instead of two]

doImport: which=“new”, fileOrDir="/mnt/INTERNAL/Golden Oldies.m3u"
importPlaylists
fileNdx 0
file 1 of 1 modalResult “”
calling import_m3u
import_m3u: file “/mnt/INTERNAL/Golden Oldies.m3u”
modalResult: “”
processing /mnt/INTERNAL/Golden Oldies.m3u
file has line feeds
m3uLine:1 m3uLines.length:81
importExtendedM3u line 1:
../../../2CB2-D47E/Music/If You Can Believe Your Eyes And Ears/07 California D
reamin.mp3
parsing error: ../../../2CB2-D47E/Music/If You Can Believe Your Eyes And Ears/
07 California Dreamin.mp3
importExtendedM3u line 2:
../../../2CB2-D47E/Music/Good Vibrations 40th Anniversary/01 Good Vibrations.m
p3
parsing error: ../../../2CB2-D47E/Music/Good Vibrations 40th Anniversary/01 Go
od Vibrations.mp3

The plugin is clearly seeing the playlist, but I’m not sure what is causing the parsing error. When I look in the /data/playlist directory, I see that it has created a playlist, but it has a zero length.

Thinking that the beginning of each line in the original playlist was causing problems, I have tried a number of ways to alter the beginning of the list such as removing all of the text up to the “Music” text, replacing the beginning of each line with “NAS/McLeodOMV…”, or “mnt/NAS/McLeodOMV…” but I continue to get the “parsing error” message for each line in the playlist. I’m running out of ideas on how to modify the original playlist file so that it will import properly.

Looking at one of my playlists created on the Volumio unit I see the first entry as follows:

[{“service”:“mpd”,“uri”:“mnt/NAS/McLeodOMV/Original Musiquarium 1 [Disc 2]/2-07
I Wish.mp3”,“title”:“I Wish”,“artist”:“Stevie Wonder”,“album”:“Original Musiquar
ium 1 [Disc 2]”,“albumart”:"/albumart?cacheid=352&web=/Original%20Musiquarium%20
1%20%5BDisc%202%5D/extralarge&path=%2Fmnt%2FNAS%2FMcLeodOMV%2FOriginal%20Musiqua
rium%201%20%5BDisc%202%5D&icon=fa-tags&metadata=false"},

Can you help me figure out what I’m doing wrong?

Thanks,

Rick
Golden Oldies.txt

@skiphansen
Copy link
Owner

Where is "07 California Dreamin.mp3" actually located from the viewpoint of Volumio?

Is it "/mnt/NAS/McLeodOMV/If You Can Believe Your Eyes And Ears/07 California Dreamin.mp3" ?

My brain is a bit foggy about how my code works... I'm really a C programmer, I was just pretending to be a Javascript/Typescript programmer for this project!

Skip
BTW like your playlist, I could listen to it !

@rgmcleod52
Copy link
Author

Skip,

Your guess as to the actual location of "California Dreamin" is correct, it is in:

"/mnt/NAS/McLeodOMV/If You Can Believe Your Eyes And Ears/07 California Dreamin.mp3"

I hope this helps refresh what you did in coding.

No apologies necessary for your coding. As a "hacker" - in the old sense of the term - I know just enough to be dangerous in some instances and clueless in others.

Two additional comments:

  1. I think I got confused by your comments in your readme.md file:

Fill in the full path to the folder containing the playlists you wish to import. Alternately enter the full path to a specific playlist.

The path is as seen from the view point of the music library hence it MUST start with INTERNAL, NAS, or USB.

As a convenience the path is initialized to the root of the first USB drive, or NAS server found.

These first two comments - as I interpreted them - relate to the location of the playlist file you are trying to import. The last sentence - I think - relates to the path of where the music is found. If so, a little clarity here would help, or better yet, and example of what the code will deal with.

  1. One of the biggest drawbacks of the Volumio playlist implementation is the inability to reorganize a playlist's order. Every new addition to a playlist is added to the end, and there's no way to change that. In the Samsung Music app on Android, for example, you can do a simple drag of a song to where you want it. I've thought about a separate Python app that could allow reordering of Volumio playlists but I'm a real noob with Python so I keep hoping to find a solution using other people's work - like yours (so thank you). If you know of such a tool please let me know.

Rick

If you liked my Golden Oldies playlist, you might like this one too...

Hipper Than Hip.txt

@skiphansen
Copy link
Owner

One issue is that the importer expects the playlist to be located such that it would work as-is IF Volumio had .m3u support. i.e. for relative paths such as those in your playlist (../../../2CB2-D47E....) the playlist itself would have to be on your NAS in an appropriate folder.

Try replacing "../../../2CB2-D47E/Music/" with "/" and then put the edited playlist in the root of your NAS and import if from there. I think that should work.

Skip

@rgmcleod52
Copy link
Author

rgmcleod52 commented Mar 30, 2023 via email

@skiphansen
Copy link
Owner

The attachments didn't make it for some reason. Could you try attaching by dragging and dropping them via the github issue webpage? I know what works.

You're no bother, I'm glad someone is using my script. Hopefully in the end it will be worth your trouble !

Skip

@rgmcleod52
Copy link
Author

Skip,

Here's the two files ... I hope. Maybe that will shed some light on this...

Rick

m3u_importer.log
Golden_Oldies_v4.txt

@skiphansen
Copy link
Owner

skiphansen commented Mar 31, 2023

Rick,

If you give the script a path to a directory rather than a specific file it searches for *.m3u and *.m3u8 files. Files with any other extension are ignored.

Try renaming Golden_oldies_v4.txt to Golden_oldies_v4.m3u and give the script the full path, i.e. "/mnt/NAS/McLeodOMV/Golden_oldies_v4.m3u".

I should have responded to your earlier comment

These first two comments - as I interpreted them - relate to the location of the playlist file you are trying to
import. The last sentence - I think - relates to the path of where the music is found. If so, a little clarity 
here would help, or better yet, and example of what the code will deal with.

The last sentence applies to the playlist as well. When you have a USB flash drive the root is something like "/mnt/USB/e884c5ea-1fda-4111-97ae-499ae0a90627" which is pretty ugly and error prone to type. So ... the script drops that in the dialog so you don't have to type it.

Documentation isn't my strong suite, it always makes sense to ME (grin).

Skip

@rgmcleod52
Copy link
Author

Skip,

The reason I sent you a playlist file with an extension of ".txt" is because Github won't allow me to attach an .m3u file to a reply. So I did use the playlist with a .m3u extension when I ran the last test.

I just reran the experiment using the same .m3u playlist (Golden_Oldies_v4) but in the Settings I specified the file explicitly. I still get a file in /data/playlist with the right name, but zero file size.

I'm attaching the m3u_importer.log file from this most recent run.

m3u_importer 3-31.log

Rick

@skiphansen
Copy link
Owner

I've basically given up on attachments with gmail, I didn't know you couldn't attach .m3u files, but it doesn't surprise me.

Interesting, the earlier log didn't have any indication that the importer found any playlists, but m3u_importer 3-31.log does and it showed the dreaded parsing error.

I finally found the problem after refreshing my brain about the m3u format.

Rightly or wrongly when the importer finds "#EXTM3U" on the first line of the playlist it requires an #EXTINF: line with the artist name and track title before every entry.
Since your playlist doesn't have #EXTINF lines so the importer screams parsing error and fails.

Try deleting the first line (#EXTM3U) that should fix the parsing error.

I imported your playlist on my device and it complained that it didn't find the first track as expected...

Good luck!
Skip

@rgmcleod52
Copy link
Author

Skip,

I made the change to the .m3u file as you suggested. Good news and bad news. The good news is that I got a different result, the bad news is that I still end up with a playlist in /data/playlist that is zero.

I'm attaching a log file. Seems like the conversion to an absolute path is going wrong...

Rick

m3u_importer 4-1.log

@rgmcleod52
Copy link
Author

Ok, update...

After looking at the log file carefully and trying a couple of things, I figured out what my .m3u file needed to look like:

  • Remove the #EXTM3U line at the beginning
  • Replace the initial string "../../../2CB2-D47E/Music" with "/McLeodOMV"

Once I did those two things I was able to generate a playlist that would work. It wasn't without errors, but I figured out that something in the way the .m3u file was generated created some errors. Specifically, for the Tapestry album there was a "01-" prepending each song from that album (but not for any of the other albums). Not sure why.

I've got another .m3u file that I'll try a bit later, but now at least I can get your plugin to work.

Thanks for all the help! Have a great weekend!

Rick

@skiphansen
Copy link
Owner

I am glad to hear it finally did something! Hopefully now that you know how to trick into doing your bidding it will be worth the effort! Thanks for reaching out.

You might have motivated me to update to Volumio 3... I really never used Volumio much after I finished the initial work on the plugin.

My wife said nice things when I showed her how to use Volumio to access to all of our music, but she almost immediately went back to listening to Pandora on her iPad using the internal speakers. Sigh...

Skip

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants