changeset 1565:88c0aabb4286 trunk

[svn] - remove static version
author nenolod
date Thu, 10 Aug 2006 20:41:43 -0700
parents 3a60eafe91c7
children e513069caf71
files ChangeLog audacious/Makefile audacious/playlist_m3u.c audacious/playlist_pls.c
diffstat 4 files changed, 8 insertions(+), 304 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Aug 10 20:39:18 2006 -0700
+++ b/ChangeLog	Thu Aug 10 20:41:43 2006 -0700
@@ -1,3 +1,11 @@
+2006-08-11 03:39:18 +0000  William Pitcock <nenolod@nenolod.net>
+  revision [2042]
+  - m3u and pls plugin implementation
+  
+
+  Changes:        Modified:
+
+
 2006-08-11 03:35:10 +0000  William Pitcock <nenolod@nenolod.net>
   revision [2040]
   - lowlevel plugin stuff
--- a/audacious/Makefile	Thu Aug 10 20:39:18 2006 -0700
+++ b/audacious/Makefile	Thu Aug 10 20:41:43 2006 -0700
@@ -44,8 +44,6 @@
 	pluginenum.c \
 	playlist.c \
 	playlist_container.c \
-	playlist_pls.c \
-	playlist_m3u.c \
 	controlsocket.c \
 	dock.c \
 	playback.c \
--- a/audacious/playlist_m3u.c	Thu Aug 10 20:39:18 2006 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,195 +0,0 @@
-/*
- * Audacious: A cross-platform multimedia player
- * Copyright (c) 2006 William Pitcock, Tony Vroon, George Averill,
- *                    Giacomo Lozito, Derek Pomery and Yoshiki Yazawa.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include <glib.h>
-#include <string.h>
-#include <glib.h>
-#include <glib/gprintf.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/errno.h>
-
-#include "main.h"
-#include "util.h"
-#include "playlist.h"
-#include "playlist_container.h"
-
-static void
-parse_extm3u_info(const gchar * info, gchar ** title, gint * length)
-{
-    gchar *str;
-
-    g_return_if_fail(info != NULL);
-    g_return_if_fail(title != NULL);
-    g_return_if_fail(length != NULL);
-
-    *title = NULL;
-    *length = -1;
-
-    if (!str_has_prefix_nocase(info, "#EXTINF:")) {
-        g_message("Invalid m3u metadata (%s)", info);
-        return;
-    }
-
-    info += 8;
-
-    *length = atoi(info);
-    if (*length <= 0)
-        *length = -1;
-    else
-        *length *= 1000;
-
-    if ((str = strchr(info, ','))) {
-        *title = g_strstrip(g_strdup(str + 1));
-        if (strlen(*title) < 1) {
-            g_free(*title);
-            *title = NULL;
-        }
-    }
-}
-
-static void
-playlist_load_m3u(const gchar * filename, gint pos)
-{
-    FILE *file;
-    gchar *line;
-    gchar *ext_info = NULL, *ext_title = NULL;
-    gsize line_len = 1024;
-    gint ext_len = -1;
-    gboolean is_extm3u = FALSE;
-
-    if (!(file = fopen(filename, "r")))
-        return;
-
-    line = g_malloc(line_len);
-    while (fgets(line, line_len, file)) {
-        while (strlen(line) == line_len - 1 && line[strlen(line) - 1] != '\n') {
-            line_len += 1024;
-            line = g_realloc(line, line_len);
-            fgets(&line[strlen(line)], 1024, file);
-        }
-
-        while (line[strlen(line) - 1] == '\r' ||
-               line[strlen(line) - 1] == '\n')
-            line[strlen(line) - 1] = '\0';
-
-        if (str_has_prefix_nocase(line, "#EXTM3U")) {
-            is_extm3u = TRUE;
-            continue;
-        }
-
-        if (is_extm3u && str_has_prefix_nocase(line, "#EXTINF:")) {
-            str_replace_in(&ext_info, g_strdup(line));
-            continue;
-        }
-
-        if (line[0] == '#' || strlen(line) == 0) {
-            if (ext_info) {
-                g_free(ext_info);
-                ext_info = NULL;
-            }
-            continue;
-        }
-
-        if (is_extm3u) {
-            if (cfg.use_pl_metadata && ext_info)
-                parse_extm3u_info(ext_info, &ext_title, &ext_len);
-            g_free(ext_info);
-            ext_info = NULL;
-        }
-
-        playlist_load_ins_file(line, filename, pos, ext_title, ext_len);
-
-        str_replace_in(&ext_title, NULL);
-        ext_len = -1;
-
-        if (pos >= 0)
-            pos++;
-    }
-
-    fclose(file);
-    g_free(line);
-}
-
-static void
-playlist_save_m3u(const gchar *filename, gint pos)
-{
-    GList *node;
-    gchar *outstr = NULL;
-    FILE *file;
-
-    g_return_if_fail(filename != NULL);
-
-    file = fopen(filename, "wb");
-
-    g_return_if_fail(file != NULL);
-
-    if (cfg.use_pl_metadata)
-        g_fprintf(file, "#EXTM3U\n");
-
-    PLAYLIST_LOCK();
-
-    for (node = playlist_get(); node; node = g_list_next(node)) {
-        PlaylistEntry *entry = PLAYLIST_ENTRY(node->data);
-
-        if (entry->title && cfg.use_pl_metadata) {
-            gint seconds;
-
-            if (entry->length > 0)
-                seconds = (entry->length) / 1000;
-            else
-                seconds = -1;
-
-            outstr = g_locale_from_utf8(entry->title, -1, NULL, NULL, NULL);
-            if(outstr) {
-                g_fprintf(file, "#EXTINF:%d,%s\n", seconds, outstr);
-                g_free(outstr);
-                outstr = NULL;
-            } else {
-                g_fprintf(file, "#EXTINF:%d,%s\n", seconds, entry->title);
-            }
-        }
-
-        g_fprintf(file, "%s\n", entry->filename);
-    }
-
-    PLAYLIST_UNLOCK();
-
-    fclose(file);
-}
-
-PlaylistContainer plc_m3u = {
-	.name = "M3U Playlist Format",
-	.ext = "m3u",
-	.plc_read = playlist_load_m3u,
-	.plc_write = playlist_save_m3u,
-};
-
-void
-temporary_m3u_register(void)
-{
-	playlist_container_register(&plc_m3u);
-}
-
--- a/audacious/playlist_pls.c	Thu Aug 10 20:39:18 2006 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,107 +0,0 @@
-/*
- * Audacious: A cross-platform multimedia player
- * Copyright (c) 2006 William Pitcock, Tony Vroon, George Averill,
- *                    Giacomo Lozito, Derek Pomery and Yoshiki Yazawa.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include <glib.h>
-#include <string.h>
-#include <glib.h>
-#include <glib/gprintf.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/errno.h>
-
-#include "util.h"
-#include "playlist.h"
-#include "playlist_container.h"
-
-static void
-playlist_load_pls(const gchar * filename, gint pos)
-{
-    guint i, count, added_count = 0;
-    gchar key[10];
-    gchar *line;
-
-    g_return_if_fail(filename != NULL);
-
-    if (!str_has_suffix_nocase(filename, ".pls"))
-        return;
-
-    if (!(line = read_ini_string(filename, "playlist", "NumberOfEntries")))
-        return;
-
-    count = atoi(line);
-    g_free(line);
-
-    for (i = 1; i <= count; i++) {
-        g_snprintf(key, sizeof(key), "File%d", i);
-        if ((line = read_ini_string(filename, "playlist", key))) {
-            playlist_load_ins_file(line, filename, pos, NULL, -1);
-            added_count++;
-
-            if (pos >= 0)
-                pos++;
-
-            g_free(line);
-        }
-    }
-}
-
-static void
-playlist_save_pls(const gchar *filename, gint pos)
-{
-    GList *node;
-    FILE *file = fopen(filename, "wb");
-
-    g_return_if_fail(file != NULL);
-
-    g_fprintf(file, "[playlist]\n");
-    g_fprintf(file, "NumberOfEntries=%d\n", playlist_get_length());
-
-    PLAYLIST_LOCK();
-
-    for (node = playlist_get(); node; node = g_list_next(node)) {
-        PlaylistEntry *entry = PLAYLIST_ENTRY(node->data);
-
-        g_fprintf(file, "File%d=%s\n", g_list_position(playlist_get(), node) + 1,
-                  entry->filename);
-    }
-
-    PLAYLIST_UNLOCK();
-
-    fclose(file);
-}
-
-PlaylistContainer plc_pls = {
-	.name = "Winamp .pls Playlist Format",
-	.ext = "pls",
-	.plc_read = playlist_load_pls,
-	.plc_write = playlist_save_pls,
-};
-
-void
-temporary_pls_register(void)
-{
-	playlist_container_register(&plc_pls);
-}
-