Skip to main content
Topic: how to create playlist (Read 3297 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

how to create playlist

Hi all,

wondering how to create new playlist from plugin.
Tried with create_playlist() but couldn't figure out how to use it.
Perhaps somebody could give me a hint or even a little example.
Thanks
Peter

how to create playlist

Reply #1
Code: [Select]
unsigned playlist_switcher::create_playlist(const char * name,const ptr_list_interface<metadb_handle> & data)

The first parameter is the name of the new playlist, the second is the initial list of items. Where is the problem?

how to create playlist

Reply #2
Quote
Code: [Select]
unsigned playlist_switcher::create_playlist(const char * name,const ptr_list_interface<metadb_handle> & data)

The first parameter is the name of the new playlist, the second is the initial list of items. Where is the problem?
[a href="index.php?act=findpost&pid=366618"][{POST_SNAPBACK}][/a]


Yes, got it, thank you.
I tried to call it from a worker thread. There's no way to call playlist operations within a thread?

Another question, how can I add single items to playlist? Add items needs a ptr_list, but I'd like to add only one item, like handles.
Is there a simple way to do this?

how to create playlist

Reply #3
Quote
I tried to call it from a worker thread. There's no way to call playlist operations within a thread?[a href="index.php?act=findpost&pid=366850"][{POST_SNAPBACK}][/a]

As it says in the SDK:
Quote
//important: playlist engine is SINGLE-THREADED. call any APIs not from main thread and things will either blow up or refuse to work. all callbacks can be assumed to come from main thread.
Quote
//all calls from main app thread only !

Quote
Another question, how can I add single items to playlist? Add items needs a ptr_list, but I'd like to add only one item, like handles.
Is there a simple way to do this?[a href="index.php?act=findpost&pid=366850"][{POST_SNAPBACK}][/a]
Not in 0.8.3.

how to create playlist

Reply #4
Quote from: peterla,Feb 24 2006, 12:26 PM
Another question, how can I add single items to playlist? Add items needs a ptr_list, but I'd like to add only one item, like handles.
Is there a simple way to do this?[a href="index.php?act=findpost&pid=366850"][{POST_SNAPBACK}][/a]
Not in 0.8.3.
[a href="index.php?act=findpost&pid=366863"][{POST_SNAPBACK}][/a]
[/quote]


I managed it that way:

Code: [Select]
playlist_switcher *p;
p = playlist_switcher::get();
p->find_or_create_playlist("playlist");

metadb_handle_list handles1;
metadb_handle_list handles2;
handles2.add_item(handles1[i]);

playlist_oper::get()->add_items(handles2);


But how can I control to which playlist the items are sent?
At the moment it seems they are sent to the focused playlist. How can I send them to  the previousley created playlist?
Thanks.

 

how to create playlist

Reply #5
Quote
I managed it that way:

Code: [Select]
playlist_switcher *p;
p = playlist_switcher::get();
p->find_or_create_playlist("playlist");

metadb_handle_list handles1;
metadb_handle_list handles2;
handles2.add_item(handles1[i]);

playlist_oper::get()->add_items(handles2);


But how can I control to which playlist the items are sent?
At the moment it seems they are sent to the focused playlist. How can I send them to  the previousley created playlist?
Thanks.
[a href="index.php?act=findpost&pid=366865"][{POST_SNAPBACK}][/a]

Quote


Ah, ok.
Code: [Select]
set_active_playlist()

 
SimplePortal 1.0.0 RC1 © 2008-2020