Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: New playlist format (Read 8580 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

New playlist format

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


New playlist format

Reply #2
thanks for the hints. i will let you know as fast as i have any results or more questions ^^

New playlist format

Reply #3
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: [Select]
'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)?

New playlist format

Reply #4
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

New playlist format

Reply #5
Ok, let me save some time for you. Here is a helloworld-grade playlist loader.

Code: [Select]
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_;

New playlist format

Reply #6
Thanks Yegor!

That helped very much!

New playlist format

Reply #7
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.

New playlist format

Reply #8
Is it possible to get in the next SDK a method which returns all the media libraries?

New playlist format

Reply #9
Maybe you could share your idea to brainstorm it a little bit? You don't seem to be making just a new playlist format.

New playlist format

Reply #10
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?

New playlist format

Reply #11
It's as clear as daylight.

First, you may want to try library_manager::get_relative_path
Code: [Select]
//! 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.
virtual bool get_relative_path(const metadb_handle_ptr & p_item,pfc::string_base & p_out) = 0;
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.

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.

New playlist format

Reply #12
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.

New playlist format

Reply #13
I dunno.

New playlist format

Reply #14
^^, ok.

My question again: Is it possible to add a method in the SDK to get the paths of all media libraries?

New playlist format

Reply #15
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

New playlist format

Reply #16
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.

New playlist format

Reply #17
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.