Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/azatoth/minidlna.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Maggard <jmaggard@users.sourceforge.net>2010-01-14 00:15:07 +0300
committerJustin Maggard <jmaggard@users.sourceforge.net>2010-01-14 00:15:07 +0300
commit947f3491c77b8ab376c9cb01ece57fd1d853abc8 (patch)
treeb5834531f544edfd9b848dff1686f84b29b9f415 /scanner.c
parentcc0955abc5e72beaa9f79c0c233df5161253ce0d (diff)
* Add M3U/PLS music playlist support.
Diffstat (limited to 'scanner.c')
-rw-r--r--scanner.c31
1 files changed, 26 insertions, 5 deletions
diff --git a/scanner.c b/scanner.c
index a90ed1d..edad1ec 100644
--- a/scanner.c
+++ b/scanner.c
@@ -30,6 +30,7 @@
#include "upnpglobalvars.h"
#include "metadata.h"
+#include "playlist.h"
#include "utils.h"
#include "sql.h"
#include "scanner.h"
@@ -479,6 +480,11 @@ insert_file(char * name, const char * path, const char * parentID, int object)
if( !detailID )
strcpy(name, orig_name);
}
+ else if( is_playlist(name) )
+ {
+ if( insert_playlist(path, name) == 0 )
+ return 1;
+ }
if( !detailID && is_audio(name) )
{
strcpy(base, MUSIC_DIR_ID);
@@ -534,7 +540,8 @@ CreateDatabase(void)
"1$5", "1", "Genre",
"1$6", "1", "Artist",
"1$7", "1", "Album",
- "1$14", "1", "Folders",
+ MUSIC_DIR_ID, "1", "Folders",
+ MUSIC_PLIST_ID, "1", "Playlists",
"2", "0", "Video",
"2$8", "2", "All Video",
VIDEO_DIR_ID, "2", "Folders",
@@ -542,7 +549,7 @@ CreateDatabase(void)
"3$11", "3", "All Pictures",
"3$12", "3", "Date Taken",
"3$13", "3", "Camera",
- "3$16", "3", "Folders",
+ IMAGE_DIR_ID, "3", "Folders",
"64", "0", "Browse Folders",
0 };
@@ -595,6 +602,15 @@ CreateDatabase(void)
")");
if( ret != SQLITE_OK )
goto sql_failed;
+ ret = sql_exec(db, "CREATE TABLE PLAYLISTS ("
+ "ID INTEGER PRIMARY KEY AUTOINCREMENT, "
+ "NAME TEXT NOT NULL, "
+ "PATH TEXT NOT NULL, "
+ "ITEMS INTEGER DEFAULT 0, "
+ "FOUND INTEGER DEFAULT 0"
+ ")");
+ if( ret != SQLITE_OK )
+ goto sql_failed;
ret = sql_exec(db, "CREATE TABLE SETTINGS ("
"UPDATE_ID INTEGER PRIMARY KEY DEFAULT 0, "
"FLAGS INTEGER DEFAULT 0"
@@ -636,8 +652,10 @@ filter_audio(const struct dirent *d)
(d->d_type == DT_LNK) ||
(d->d_type == DT_UNKNOWN) ||
((d->d_type == DT_REG) &&
- is_audio(d->d_name) )
- ) );
+ (is_audio(d->d_name) ||
+ is_playlist(d->d_name)
+ )
+ ) ));
}
int
@@ -674,7 +692,8 @@ filter_media(const struct dirent *d)
((d->d_type == DT_REG) &&
(is_image(d->d_name) ||
is_audio(d->d_name) ||
- is_video(d->d_name)
+ is_video(d->d_name) ||
+ is_playlist(d->d_name)
)
) ));
}
@@ -796,6 +815,8 @@ start_scanner()
* client that uses UPnPSearch on large containers). */
sql_exec(db, "create INDEX IDX_SEARCH_OPT ON OBJECTS(OBJECT_ID, CLASS, DETAIL_ID);");
+ fill_playlists();
+
//JM: Set up a db version number, so we know if we need to rebuild due to a new structure.
sql_exec(db, "pragma user_version = %d;", DB_VERSION);
}