Old 18th July 2011, 22:25   #1
Brent2121
Junior Member
 
Join Date: May 2009
Posts: 48
Automate Smart View Exporting to m3u files

I apologize if there is already a way to easily do this.

What I'd like is a way to select a destination folder, then press a button that would cause all smart views to be exported as m3u playlist files into that destination folder, using the view names to create the file names.

Or if someone could point me in the direction of the easiest way for me to implement it myself, that'd be much appreciated.
Brent2121 is offline   Reply With Quote
Old 16th August 2011, 03:34   #2
MrSinatra
Forum King
 
MrSinatra's Avatar
 
Join Date: Dec 2004
Location: WKPS, State College
Posts: 5,197
Send a message via AIM to MrSinatra
Quote:
Originally Posted by Brent2121 View Post
I apologize if there is already a way to easily do this.

What I'd like is a way to select a destination folder, then press a button that would cause all smart views to be exported as m3u playlist files into that destination folder, using the view names to create the file names.

Or if someone could point me in the direction of the easiest way for me to implement it myself, that'd be much appreciated.
good idea!

PENN STATE Radio or http://www.LION-Radio.org/
--
BUG #1 = Winamp skips short tracks
Wish #1 = Multiple Column Sorting
Wish #2 = Add TCMP/Compilation editing
MrSinatra is offline   Reply With Quote
Old 12th December 2011, 23:10   #3
Brent2121
Junior Member
 
Join Date: May 2009
Posts: 48
So I decided to look into making a plugin for this. I setup an IDE and have the basic example plugin from the wiki working (just pops up message boxes when it initializes and when the user hits the "configure" button). Trying to find the right APIs that I need is somewhat overwhelming. Any suggestions for where to look? Also, probably hands down the most helpful thing would be examples. I see this mentioned in the wiki, but there's no link to any actual example code. It says something about how a good starting point is to find a plugin that does something similar to what I want to do and look at its code, but I have no idea where to find any plugin code.

I figure that I'll need to get a list of smart views in the media library, and then for each one: clear the queue, enqueue all songs in the smart view, save the queue to a playlist file (m3u).

Once I get that working, I can worry about adding and options panel in the preferences dialog, with settings for the location to save the m3u files and possibly letting the user select which smart views to export.
Brent2121 is offline   Reply With Quote
Old 12th December 2011, 23:28   #4
DrO
 
Join Date: Sep 2003
Posts: 27,880
might be easier if i just finish off my exporter plug-in to dump the smart view contents (is already part-implemented but not fully hooked up to any ui handling) since a smart view dump is just a larger query compared to the full db query dump which it does (and which Winamp does as well for the library views).

if not, you'd be best using the nde library and query for the data directly from that (though there's not much of an example for doing that either - like most Winamp things).

Quote:
I figure that I'll need to get a list of smart views in the media library, and then for each one: clear the queue, enqueue all songs in the smart view, save the queue to a playlist file (m3u).
that sounds a hideous thing to try to do plus it's just making things far more complicated than would be needed (plus messing with playlist editor / queue contents would massively annoy people) since you'd just get the smart view result / data (however you'd end up going) and just directly save to the output file (quicker and far less annoying).

-daz
DrO is offline   Reply With Quote
Old 12th December 2011, 23:59   #5
Brent2121
Junior Member
 
Join Date: May 2009
Posts: 48
Quote:
Originally Posted by DrO View Post
that sounds a hideous thing to try to do plus it's just making things far more complicated than would be needed (plus messing with playlist editor / queue contents would massively annoy people) since you'd just get the smart view result / data (however you'd end up going) and just directly save to the output file (quicker and far less annoying).
I just figured that the saving of the queue functionality was already built in, so it might be less coding to go through the queue than saving the smart view info directly to an m3u myself... I'd like to not have to know anything about the m3u format if possible (yeah, I know it's just a bunch of file paths, but I'm not sure about the format of the #EXTINF lines or whether or not they're useful outside of winamp).

Your code for the exporter plug-in wouldn't happen to be available to look at, would it?
Brent2121 is offline   Reply With Quote
Old 13th December 2011, 00:03   #6
DrO
 
Join Date: Sep 2003
Posts: 27,880
for the playlist you can just dump the raw file paths (which should be fully qualified from what i remember of how the library works) and that's then a valid playlist - the #extinf stuff is only needed if you want to store a pre-formatted title / length of the file to speed up loading of large playlists for Winamp or other players.

i used the nde example plug-in (mlExplorer) as the basis for my one which is probably better to use if you're new to things (though i cannot remember how current that version of nde is compared to what Winamp uses currently so it might have some issues with handling things but i'm not 100% sure on that).

-daz
DrO is offline   Reply With Quote
Old 13th December 2011, 00:28   #7
Brent2121
Junior Member
 
Join Date: May 2009
Posts: 48
Yeah, I just stumbled onto that mlExplorer example and it looks promising. However, I'm getting linker errors like this when I build:

[Linker error] undefined reference to `Database:atabase()'
[Linker error] undefined reference to `Database::OpenTable(char*, char*, int, int)'

I assume I need to link in the nde library, although I don't really understand why as I thought that building a .dll meant that it was linked at runtime and it didn't need to find these external objects when building my .dll. I'm using Dev-C++. Is there a known project setting that I need to change?
Brent2121 is offline   Reply With Quote
Old 13th December 2011, 00:41   #8
DrO
 
Join Date: Sep 2003
Posts: 27,880
none of the examples are setup for use with Dev-C++ (can't even remember if i've ever tried using that) and i'm not sure at the moment on what would even be needed for getting it all to link (is almost 15months since i needed to figure that out) and could even by that Dev-C++ doesn't like it (as Winamp is quite MSVC-centric in places that may not help with things). anyhoo, need some sleep so won't reply back until the morning my time.

-daz
DrO is offline   Reply With Quote
Old 13th December 2011, 12:28   #9
DrO
 
Join Date: Sep 2003
Posts: 27,880
just done a bit of work on my plug-in this morning whilst waiting around for a few things and have most of the handling put in place (need to sanitise the names a bit since it's possible to have non-filename characters and have the same smart view name + add a dialog to select only those wanted - just does all at the moment).

also need to split the output generation off to it's own thread so it's not going to lock up the ui when processing a large number of smartviews (or any of the other exports it can do). but i can send over a test build of the plug-in if you want to see if it'll output as you'd expect, etc. otherwise i'll look to finish things off over the next few mornings and get a new version out (might even quickly hook up the xspf output as well and call it a 1.0).

-daz
DrO is offline   Reply With Quote
Old 13th December 2011, 17:57   #10
Brent2121
Junior Member
 
Join Date: May 2009
Posts: 48
Quote:
Originally Posted by Brent2121 View Post
Yeah, I just stumbled onto that mlExplorer example and it looks promising. However, I'm getting linker errors like this when I build:

[Linker error] undefined reference to `Database:: Database()'
[Linker error] undefined reference to `Database::OpenTable(char*, char*, int, int)'

I assume I need to link in the nde library, although I don't really understand why as I thought that building a .dll meant that it was linked at runtime and it didn't need to find these external objects when building my .dll. I'm using Dev-C++. Is there a known project setting that I need to change?
I'm getting the same errors in MS Visual C++ 2010 Express. Here's the output:

1>------ Build started: Project: svtom3u, Configuration: Debug Win32 ------
1> Creating library Y:\Programming\Winamp Plugins\Smart View to M3U\svtom3u\Debug\svtom3u.lib and object Y:\Programming\Winamp Plugins\Smart View to M3U\svtom3u\Debug\svtom3u.exp
1>gen_svtom3u.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall Database::~Database(void)" (__imp_??1Database@@QAE@XZ) referenced in function "void __cdecl config(void)" (?config@@YAXXZ)
1>gen_svtom3u.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall Database::CloseTable(class Table *)" (__imp_?CloseTable@Database@@QAEXPAVTable@@@Z) referenced in function "void __cdecl config(void)" (?config@@YAXXZ)
1>gen_svtom3u.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall Table:: DeleteScanner(class Scanner *)" (__imp_?DeleteScanner@Table@@QAEXPAVScanner@@@Z) referenced in function "void __cdecl config(void)" (?config@@YAXXZ)
1>gen_svtom3u.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: char * __thiscall StringField::GetString(void)" (__imp_?GetString@StringField@@QAEPADXZ) referenced in function "void __cdecl config(void)" (?config@@YAXXZ)
1>gen_svtom3u.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class Field * __thiscall Scanner::GetFieldByName(char const *)" (__imp_?GetFieldByName@Scanner@@QAEPAVField@@PBD@Z) referenced in function "void __cdecl config(void)" (?config@@YAXXZ)
1>gen_svtom3u.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: int __thiscall Scanner::Eof(void)" (__imp_?Eof@Scanner@@QAEHXZ) referenced in function "void __cdecl config(void)" (?config@@YAXXZ)
1>gen_svtom3u.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: int __thiscall Scanner::Next(int,int *)" (__imp_?Next@Scanner@@QAEHHPAH@Z) referenced in function "void __cdecl config(void)" (?config@@YAXXZ)
1>gen_svtom3u.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall Scanner::First(int *)" (__imp_?First@Scanner@@QAEXPAH@Z) referenced in function "void __cdecl config(void)" (?config@@YAXXZ)
1>gen_svtom3u.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class Scanner * __thiscall Table::NewScanner(int)" (__imp_?NewScanner@Table@@QAEPAVScanner@@H@Z) referenced in function "void __cdecl config(void)" (?config@@YAXXZ)
1>gen_svtom3u.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: int __thiscall Table::GetRecordsCount(void)" (__imp_?GetRecordsCount@Table@@QAEHXZ) referenced in function "void __cdecl config(void)" (?config@@YAXXZ)
1>gen_svtom3u.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class Table * __thiscall Database::OpenTable(char *,char *,int,int)" (__imp_?OpenTable@Database@@QAEPAVTable@@PAD0HH@Z) referenced in function "void __cdecl config(void)" (?config@@YAXXZ)
1>gen_svtom3u.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall Database:: Database(void)" (__imp_??0Database@@QAE@XZ) referenced in function "void __cdecl config(void)" (?config@@YAXXZ)
1>Y:\Programming\Winamp Plugins\Smart View to M3U\svtom3u\Debug\svtom3u.dll : fatal error LNK1120: 12 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

There's got to be some simple fix to this... it's just saying that it needs to link with the objects in the NDE library, which I don't think it should be trying to do, since it's supposed to be building a dll which will be linked with the NDE dll at runtime.
Brent2121 is offline   Reply With Quote
Old 13th December 2011, 18:23   #11
DrO
 
Join Date: Sep 2003
Posts: 27,880
it needs to be linking against nde.lib which you'd also need to build and ensure it's set to be linked with in the project settings - as otherwise it's not going to know what to use from the nde.dll when you've got the plug-in compiling.

-daz
DrO is offline   Reply With Quote
Old 13th December 2011, 18:32   #12
Brent2121
Junior Member
 
Join Date: May 2009
Posts: 48
Quote:
Originally Posted by DrO View Post
it needs to be linking against nde.lib which you'd also need to build and ensure it's set to be linked with in the project settings - as otherwise it's not going to know what to use from the nde.dll when you've got the plug-in compiling.
Got it, thanks.

Quote:
Originally Posted by DrO View Post
but i can send over a test build of the plug-in if you want to see if it'll output as you'd expect, etc. otherwise i'll look to finish things off over the next few mornings and get a new version out (might even quickly hook up the xspf output as well and call it a 1.0).

-daz
I'd love to test it out. Whenever it's convenient for you. Thanks.
Brent2121 is offline   Reply With Quote
Old 13th December 2011, 18:44   #13
DrO
 
Join Date: Sep 2003
Posts: 27,880
pm sent with a link to a test build...

-daz
DrO is offline   Reply With Quote
Old 14th December 2011, 18:25   #14
DrO
 
Join Date: Sep 2003
Posts: 27,880
as follow-up for anyone following this, from the test builds sent, the updates imade to my plug-in are working including allowing the playlist output to use relative filepaths where applicable.

still need to add in the means to only select certain smartviews and create xspf playlists (so there is an xml output), but it should be a few days before a 1.0 is released (already has fixes for bookmark playlists not being correct, massively reduced the time it takes to generate large dumps).

thanks Brent2121 for giving me a kick to work on this one again

-daz
DrO is offline   Reply With Quote
Old 30th December 2012, 21:53   #15
DrO
 
Join Date: Sep 2003
Posts: 27,880
oh well, plans never quite worked out as intended as i've only just had a chance to work on the plug-in again (and even that's limited as there's no means to do specific smartviews). either way, link to new build is at http://nunzioweb.com/daz/releases.html#30/12/2012

-daz
DrO is offline   Reply With Quote
Old 31st December 2012, 06:49   #16
MrSinatra
Forum King
 
MrSinatra's Avatar
 
Join Date: Dec 2004
Location: WKPS, State College
Posts: 5,197
Send a message via AIM to MrSinatra
i'll be sure to test this as i think its a great idea, but i would need a pref or something to make it useful to me, as i need only certain SMVs exported, not all of them. (i'm configuring for someone else)

PENN STATE Radio or http://www.LION-Radio.org/
--
BUG #1 = Winamp skips short tracks
Wish #1 = Multiple Column Sorting
Wish #2 = Add TCMP/Compilation editing
MrSinatra is offline   Reply With Quote
Old 31st December 2012, 11:38   #17
DrO
 
Join Date: Sep 2003
Posts: 27,880
i know there needs to be a way to just selectively do smartviews instead of a complete dump of all of them (as mentioned in the changelog and on the plug-ins page). but i wanted to get something out for this one as it's been too long and with a complete dump of the views, it's at least possible to get the ones which are wanted and just remove the others not needed. so based on how things have been going, it's likely 2014 or never that i'll get that configurability done.

-daz
DrO is offline   Reply With Quote
Reply
Go Back   Winamp & SHOUTcast Forums > Winamp > Winamp Wishlist

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump