New playlist format |
This forum is for developer discussions only. If you have a problem / bug report / idea / feature request that isn't related to foobar2000 SDK, post it in an appropiate forum instead - tech support questions go to support forum, everything else goes to general forum.
All non-developer posts on this forum will be removed. Continued abuse of this forum will result in admin actions (warnings, account suspension).
![]() ![]() |
New playlist format |
Apr 28 2011, 20:46
Post
#1
|
|
![]() Group: Members Posts: 17 Joined: 28-April 11 Member No.: 90180 |
Hi!
I'm new at developing features for foobar2000, but I would like to try a new file format for playlists. I've already had a look into the tutorials, but if someone could explain some things, I will be definitely faster. I would just need the info where/how I can read and write a playlist file and how I can find out which folders are in the media library. regards, the This post has been edited by the: Apr 28 2011, 21:05 |
|
|
|
Apr 28 2011, 21:56
Post
#2
|
|
![]() Group: FB2K Moderator (Donating) Posts: 4219 Joined: 24-February 03 Member No.: 5153 |
You need to implement a playlist_loader service. I don't know what you want to do with media library paths, but if there is anything in the SDK, it should be in the library_manager service.
-------------------- http://foosion.foobar2000.org/ - my components for foobar2000
|
|
|
|
Apr 29 2011, 03:39
Post
#3
|
|
![]() Group: Members Posts: 17 Joined: 28-April 11 Member No.: 90180 |
thanks for the hints. i will let you know as fast as i have any results or more questions ^^
This post has been edited by the: Apr 29 2011, 04:10 |
|
|
|
Apr 30 2011, 02:16
Post
#4
|
|
![]() Group: Members Posts: 17 Joined: 28-April 11 Member No.: 90180 |
Ok, it seems that i'm already stuck at the very beginning.
I followed the instructions of this tutorial: http://yirkha.fud.cz/tmp/496351ef.tutorial-draft.html Everything compiles, but somehow i can't debug. I always get a "Component maintanence failure: Could not list pending directory: Invalid path syntax" from foobar2000 The dll is in the right directory (components) and will always be copied with a post build command. Command and Working Directory are also set as explained in the tutorial. This is the output I get. CODE 'foobar2000.exe': Loaded 'E:\Arbeiten\foobar2000\SDK-2011-03-11\test\foobar2000.exe', Cannot find or open the PDB file 'foobar2000.exe': Loaded 'C:\Windows\SysWOW64\ntdll.dll', Cannot find or open the PDB file 'foobar2000.exe': Loaded 'C:\Windows\SysWOW64\kernel32.dll', Cannot find or open the PDB file 'foobar2000.exe': Loaded 'C:\Windows\SysWOW64\KernelBase.dll', Cannot find or open the PDB file 'foobar2000.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7601.17514_none_41e6975e2bd6f2b2\comctl32.dll', Cannot find or open the PDB file 'foobar2000.exe': Loaded 'C:\Windows\SysWOW64\msvcrt.dll', Cannot find or open the PDB file 'foobar2000.exe': Loaded 'C:\Windows\SysWOW64\gdi32.dll', Cannot find or open the PDB file 'foobar2000.exe': Loaded 'C:\Windows\SysWOW64\user32.dll', Cannot find or open the PDB file 'foobar2000.exe': Loaded 'C:\Windows\SysWOW64\advapi32.dll', Cannot find or open the PDB file 'foobar2000.exe': Loaded 'C:\Windows\SysWOW64\sechost.dll', Cannot find or open the PDB file 'foobar2000.exe': Loaded 'C:\Windows\SysWOW64\rpcrt4.dll', Cannot find or open the PDB file 'foobar2000.exe': Loaded 'C:\Windows\SysWOW64\sspicli.dll', Cannot find or open the PDB file 'foobar2000.exe': Loaded 'C:\Windows\SysWOW64\cryptbase.dll', Cannot find or open the PDB file 'foobar2000.exe': Loaded 'C:\Windows\SysWOW64\lpk.dll', Cannot find or open the PDB file 'foobar2000.exe': Loaded 'C:\Windows\SysWOW64\usp10.dll', Cannot find or open the PDB file 'foobar2000.exe': Loaded 'C:\Windows\SysWOW64\shlwapi.dll', Cannot find or open the PDB file 'foobar2000.exe': Loaded 'C:\Windows\SysWOW64\dsound.dll', Cannot find or open the PDB file 'foobar2000.exe': Loaded 'C:\Windows\SysWOW64\ole32.dll', Cannot find or open the PDB file 'foobar2000.exe': Loaded 'C:\Windows\SysWOW64\winmm.dll', Cannot find or open the PDB file 'foobar2000.exe': Loaded 'C:\Windows\SysWOW64\powrprof.dll', Cannot find or open the PDB file 'foobar2000.exe': Loaded 'C:\Windows\SysWOW64\setupapi.dll', Cannot find or open the PDB file 'foobar2000.exe': Loaded 'C:\Windows\SysWOW64\cfgmgr32.dll', Cannot find or open the PDB file 'foobar2000.exe': Loaded 'C:\Windows\SysWOW64\oleaut32.dll', Cannot find or open the PDB file 'foobar2000.exe': Loaded 'C:\Windows\SysWOW64\devobj.dll', Cannot find or open the PDB file 'foobar2000.exe': Loaded 'C:\Windows\SysWOW64\uxtheme.dll', Cannot find or open the PDB file 'foobar2000.exe': Loaded 'C:\Windows\SysWOW64\shell32.dll', Cannot find or open the PDB file 'foobar2000.exe': Loaded 'E:\Arbeiten\foobar2000\SDK-2011-03-11\test\zlib1.dll', Cannot find or open the PDB file 'foobar2000.exe': Loaded 'E:\Arbeiten\foobar2000\SDK-2011-03-11\test\shared.dll', Cannot find or open the PDB file 'foobar2000.exe': Loaded 'C:\Windows\SysWOW64\imagehlp.dll', Cannot find or open the PDB file 'foobar2000.exe': Loaded 'C:\Windows\SysWOW64\dbghelp.dll', Cannot find or open the PDB file 'foobar2000.exe': Loaded 'C:\Windows\SysWOW64\comdlg32.dll', Cannot find or open the PDB file 'foobar2000.exe': Loaded 'C:\Windows\SysWOW64\secur32.dll', Cannot find or open the PDB file 'foobar2000.exe': Loaded 'C:\Windows\SysWOW64\crypt32.dll', Cannot find or open the PDB file 'foobar2000.exe': Loaded 'C:\Windows\SysWOW64\msasn1.dll', Cannot find or open the PDB file 'foobar2000.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.7601.17514_none_72d18a4386696c80\GdiPlus.dll', Cannot find or open the PDB file 'foobar2000.exe': Loaded 'C:\Windows\SysWOW64\imm32.dll', Cannot find or open the PDB file 'foobar2000.exe': Loaded 'C:\Windows\SysWOW64\msctf.dll', Cannot find or open the PDB file 'foobar2000.exe': Loaded 'C:\Windows\SysWOW64\clbcatq.dll', Cannot find or open the PDB file 'foobar2000.exe': Loaded 'C:\Windows\SysWOW64\MMDevAPI.dll', Cannot find or open the PDB file 'foobar2000.exe': Loaded 'C:\Windows\SysWOW64\propsys.dll', Cannot find or open the PDB file 'foobar2000.exe': Loaded 'C:\Windows\SysWOW64\dwmapi.dll', Cannot find or open the PDB file The thread 'Win32 Thread' (0x133c) has exited with code 0 (0x0). First-chance exception at 0x74b1b727 in foobar2000.exe: Microsoft C++ exception: `anonymous namespace'::exception_io_invalid_path_syntax at memory location 0x0067edbc.. First-chance exception at 0x74b1b727 in foobar2000.exe: Microsoft C++ exception: foobar2000_io::exception_io at memory location 0x0067f154.. First-chance exception at 0x74b1b727 in foobar2000.exe: Microsoft C++ exception: exception_messagebox at memory location 0x0067fc00.. First-chance exception at 0x74b1b727 in foobar2000.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000.. Initialization failure : Component maintenance failure: Could not list pending directory: Invalid path syntax The thread 'Win32 Thread' (0x1b4) has exited with code 0 (0x0). 'foobar2000.exe': Loaded 'C:\Windows\SysWOW64\wintrust.dll', Cannot find or open the PDB file The thread 'Win32 Thread' (0x102c) has exited with code -1 (0xffffffff). The thread 'Win32 Thread' (0x80c) has exited with code -1 (0xffffffff). The thread 'Win32 Thread' (0x10a8) has exited with code -1 (0xffffffff). The program '[4684] foobar2000.exe: Native' has exited with code -1 (0xffffffff). And one other thing. Is there anywhere the source of another implemented playlist_loader (e.g. the one which creates the ".m3u" files)? This post has been edited by the: Apr 30 2011, 02:18 |
|
|
|
Apr 30 2011, 16:00
Post
#5
|
|
![]() Group: Members Posts: 17 Joined: 28-April 11 Member No.: 90180 |
I did it again and now it works. I couldn't find out what I did wrong.
The other question is still there. Is there somewhere a source of an implemented playlist_loader? It could save me some time. regards, the This post has been edited by the: Apr 30 2011, 16:05 |
|
|
|
May 1 2011, 17:26
Post
#6
|
|
![]() Group: Developer Posts: 251 Joined: 8-April 09 From: Russia, Zlatoust Member No.: 68779 |
Ok, let me save some time for you. Here is a helloworld-grade playlist loader.
CODE class my_loader : public playlist_loader {
public: virtual void open(const char * p_path, const service_ptr_t<file> & p_file,playlist_loader_callback::ptr p_callback, abort_callback & p_abort) { // Of course, you should provide all the data you have including filestats and file_info metadb_handle_ptr dummy; t_filestats stats; p_callback->handle_create(dummy, make_playable_location("file://C:\\whatever.mp3", 0)); p_callback->on_progress("file://C:\\whatever.mp3"); p_callback->on_entry(dummy, playlist_loader_callback::entry_from_playlist, stats, false); } virtual void write(const char * p_path, const service_ptr_t<file> & p_file,metadb_handle_list_cref p_data,abort_callback & p_abort) { } virtual const char * get_extension() { return "abc"; } virtual bool can_write() { return false; } virtual bool is_our_content_type(const char* p_content_type) { return false; } virtual bool is_associatable() { return false; } }; static playlist_loader_factory_t<my_loader> _loader_; |
|
|
|
May 2 2011, 15:19
Post
#7
|
|
![]() Group: Members Posts: 17 Joined: 28-April 11 Member No.: 90180 |
Thanks Yegor!
That helped very much! |
|
|
|
May 5 2011, 01:36
Post
#8
|
|
![]() Group: Members Posts: 17 Joined: 28-April 11 Member No.: 90180 |
A few more questions:
I still haven't found a way to get all folders from the media library. The only thing I found is library_manager::get_relative_path. Is there really no way to get them? Is there a way to get from a relative path (of an audio file) to the metadb_handle_ptr? I mean the reverse way of library_manager::get_relative_path. (Wouldn't be necessary, if I would have the media folders) Do I have to use the classes of the SDK or can I include other headers like fstream to read a file? If not, what is the best way to read line by line from a foobar2000_io::file? Best Regards, the PS: The component is already running. If I can improve it a little bit more, I will release a first beta version soon. |
|
|
|
May 14 2011, 01:50
Post
#9
|
|
![]() Group: Members Posts: 17 Joined: 28-April 11 Member No.: 90180 |
Is it possible to get in the next SDK a method which returns all the media libraries?
|
|
|
|
May 14 2011, 06:28
Post
#10
|
|
![]() Group: Developer Posts: 251 Joined: 8-April 09 From: Russia, Zlatoust Member No.: 68779 |
Maybe you could share your idea to brainstorm it a little bit? You don't seem to be making just a new playlist format.
|
|
|
|
May 14 2011, 23:08
Post
#11
|
|
![]() Group: Members Posts: 17 Joined: 28-April 11 Member No.: 90180 |
The idea is to make it easier to transfer a playlist from one computer to another.
.m3u for example saves only a path of a song relative to the m3u file or the absolute path if there is no relative. Problems: 1) If you create a playlist on one computer you need to save the file in a specific folder to make it possible to load it on another computer, where it also has to be at the right spot. 2) If I don't have all my music libraries on the same hard disk, then there will definitely be absolute paths in the file. So the playlist is pretty useless on another computer. My idea is to save the absolute path of the song in the playlist file, but with some signs in between, so that I see possible relative paths. for example: You have a media library in foobar: "C:\my\great\media_library" You have a song in there "C:\my\great\media_library\artist\album\song.mp3" You save the playlist file at "C:\my\playlist.file" In the new playlist file you would get "C:\my\?great\media_library\>artist\album\song.mp3" The "?" indicates the relative path to the playlist file. ">" indicates the relative path to the media library. And you have the absolute path. If you have a file with such paths, you have more possibilities to find the song. You can use the absolute path. You can use the relative path to the playlist file ("?") like with m3u. And now there is the part where I would need the paths of the media libraries. You could try to find the song with the relative path (">") in one of your libraries. "?" and ">" are not allowed in a path of the filesystem, that's the reason why I would use them in the file. Is it at least a little bit clear, what I try to do? |
|
|
|
May 15 2011, 04:26
Post
#12
|
|
![]() Group: Developer Posts: 251 Joined: 8-April 09 From: Russia, Zlatoust Member No.: 68779 |
It's as clear as daylight.
First, you may want to try library_manager::get_relative_path CODE //! Retrieves path of the specified item relative to the Media Library folder it is in. Returns true on success, false when the item is not in the Media Library. Not only could you obtain the library path using this function, you could also use the result directly in your playlist format along with the playlist-relative path.virtual bool get_relative_path(const metadb_handle_ptr & p_item,pfc::string_base & p_out) = 0; Second, you won't be able to store the playlist path as part of the absolute filename because you can save it on a different volume or in a different folder. Third, I would consider using some other properties as an addition to paths and filenames, i.e. tags. But not all at once. Make it the way you described it first. Finally, both “?” and “>” are perfectly legal as far as NTFS is concerned. It's the Windows kernel that forbids them. If I were you I'd rather use different lines of the playlist text file to separate all that stuff. |
|
|
|
May 15 2011, 05:45
Post
#13
|
|
![]() Group: Members Posts: 17 Joined: 28-April 11 Member No.: 90180 |
I'm already using the method library_manager::get_relative_path, but I don't need the the media library from the computer where I am creating the file. I need the libraries of the computer where I'm reading it, so that I can try if the relative path exists in one of the libraries.
Second, I should have mentioned it. I only store the playlist path as part of the absolute filename, if the file is saved in a folder of the filename. Third, could you explain it a little bit more how other properties would improve the playlist? I'm still a newbie ^^ Finally, I think also the linux kernel forbids them. That's the reason why I chose them. (I have no idea how it is with mac.) But I will think about using different lines. |
|
|
|
May 15 2011, 08:40
Post
#14
|
|
![]() Group: Developer Posts: 251 Joined: 8-April 09 From: Russia, Zlatoust Member No.: 68779 |
I dunno.
|
|
|
|
May 16 2011, 20:14
Post
#15
|
|
![]() Group: Members Posts: 17 Joined: 28-April 11 Member No.: 90180 |
^^, ok.
My question again: Is it possible to add a method in the SDK to get the paths of all media libraries? |
|
|
|
Jun 11 2011, 23:07
Post
#16
|
|
![]() Group: Members Posts: 17 Joined: 28-April 11 Member No.: 90180 |
Some time went by, so is there anyone who can give an answer?
Something like YES/NO/Don't know/I'm scared would be nice |
|
|
|
Jun 12 2011, 17:35
Post
#17
|
|
![]() Group: Members Posts: 1684 Joined: 28-May 06 From: Düsseldorf Member No.: 31251 |
I can't estimate what you exactly are trying but you should check if foo_softplaylists maybe already contain the functionality you like. Take a look in main menu -> library -> load/save xspf playlist.
-------------------- german support forum: www.foobar-users.de / user: qwert73
|
|
|
|
Jun 13 2011, 19:14
Post
#18
|
|
![]() Group: Members Posts: 17 Joined: 28-April 11 Member No.: 90180 |
Actually a pretty nice plugin and also the xspf format is sophisticated, but there are some small things which I don't really like.
1. I don't need the last.fm stuff. So a plugin without that would be great (foo_xspf seems not to work anymore) 2. Why is the save\load function an entry in library? Wouldn't it be easier to implement a playlist_loader? I didn't have time to test the xspf format too much, but i think it could do the job (btw. the explanation what i'm trying to do is given above). I still would like to have method to get the paths of the media libraries. 1) I still would like to test my approach and 2) I think that it also could be used for other plugins. Actually I'm surprised that no one needed it so far. This post has been edited by the: Jun 13 2011, 19:16 |
|
|
|
Jun 13 2011, 19:53
Post
#19
|
|
![]() Group: Members Posts: 1684 Joined: 28-May 06 From: Düsseldorf Member No.: 31251 |
Why is the save\load function an entry in library? Wouldn't it be easier to implement a playlist_loader? The posts #160, #161 and #168 might be of interest for you. -------------------- german support forum: www.foobar-users.de / user: qwert73
|
|
|
|
Jun 13 2011, 22:34
Post
#20
|
|
![]() Group: Members Posts: 17 Joined: 28-April 11 Member No.: 90180 |
Why is the save\load function an entry in library? Wouldn't it be easier to implement a playlist_loader? The posts #160, #161 and #168 might be of interest for you. that explains at least one part, but also gives me one more reason to try my approach (as soon as i get an answer to my question |
|
|
|
![]() ![]() |
|
Lo-Fi Version | Time is now: 19th May 2013 - 16:11 |