summaryrefslogtreecommitdiffstats
path: root/tdefile-plugins/m3u
diff options
context:
space:
mode:
Diffstat (limited to 'tdefile-plugins/m3u')
-rw-r--r--tdefile-plugins/m3u/Makefile.am22
-rw-r--r--tdefile-plugins/m3u/tdefile_m3u.cpp87
-rw-r--r--tdefile-plugins/m3u/tdefile_m3u.desktop71
-rw-r--r--tdefile-plugins/m3u/tdefile_m3u.h40
4 files changed, 220 insertions, 0 deletions
diff --git a/tdefile-plugins/m3u/Makefile.am b/tdefile-plugins/m3u/Makefile.am
new file mode 100644
index 00000000..11259cad
--- /dev/null
+++ b/tdefile-plugins/m3u/Makefile.am
@@ -0,0 +1,22 @@
+## Makefile.am for m3u file meta info plugin
+
+# set the include path for X, qt and KDE
+INCLUDES = $(all_includes)
+
+# these are the headers for your project
+noinst_HEADERS = tdefile_m3u.h
+
+kde_module_LTLIBRARIES = tdefile_m3u.la
+
+tdefile_m3u_la_SOURCES = tdefile_m3u.cpp
+tdefile_m3u_la_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -ltdetexteditor -module $(KDE_PLUGIN)
+tdefile_m3u_la_LIBADD = $(LIB_KSYCOCA)
+
+# let automoc handle all of the meta source files (moc)
+METASOURCES = AUTO
+
+messages: rc.cpp
+ $(XGETTEXT) tdefile_m3u.cpp -o $(podir)/tdefile_m3u.pot
+
+services_DATA = tdefile_m3u.desktop
+servicesdir = $(kde_servicesdir)
diff --git a/tdefile-plugins/m3u/tdefile_m3u.cpp b/tdefile-plugins/m3u/tdefile_m3u.cpp
new file mode 100644
index 00000000..a25234e8
--- /dev/null
+++ b/tdefile-plugins/m3u/tdefile_m3u.cpp
@@ -0,0 +1,87 @@
+/* This file is part of the KDE project
+ * Copyright (C) 2001, 2002 Rolf Magnus <ramagnus@kde.org>
+ *
+ * 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 version 2.
+ *
+ * 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; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ * $Id$
+ */
+
+#include "tdefile_m3u.h"
+
+#include <kdebug.h>
+#include <kurl.h>
+#include <kprocess.h>
+#include <klocale.h>
+#include <kgenericfactory.h>
+
+#include <tqcstring.h>
+#include <tqfile.h>
+#include <tqtextstream.h>
+#include <tqdatetime.h>
+#include <tqdict.h>
+#include <tqvalidator.h>
+
+typedef KGenericFactory<KM3uPlugin> M3uFactory;
+
+K_EXPORT_COMPONENT_FACTORY( tdefile_m3u, M3uFactory( "tdefile_m3u" ) )
+
+KM3uPlugin::KM3uPlugin( TQObject *parent, const char *name,
+ const TQStringList &preferredItems )
+ : KFilePlugin( parent, name, preferredItems )
+{
+ kdDebug(7034) << "m3u plugin\n";
+
+ KFileMimeTypeInfo* info = addMimeTypeInfo( "audio/x-mpegurl" );
+
+ KFileMimeTypeInfo::GroupInfo* group;
+
+ // tracks group
+ group = addGroupInfo(info, "Tracks", i18n("Tracks"));
+ addVariableInfo(group, TQVariant::String, 0);
+}
+
+bool KM3uPlugin::readInfo( KFileMetaInfo& info, uint )
+{
+ if ( info.path().isEmpty() ) // remote file
+ return false;
+
+ TQFile f(info.path());
+ if (!f.open(IO_ReadOnly)) return false;
+ TQTextStream str(&f);
+ str.setEncoding(TQTextStream::Locale);
+
+
+ KFileMetaInfoGroup group = appendGroup(info, "Tracks");
+
+ // for now treat all lines that don't start with # like entries
+ int num = 1;
+ while (!str.atEnd())
+ {
+ TQString s = str.readLine();
+ if (!s.startsWith("#"))
+ {
+ if (s.endsWith("\n")) s.truncate(s.length()-1);
+
+ if (!s.stripWhiteSpace().isEmpty()) {
+ appendItem(group, i18n("Track %1").arg(num, 3), s);
+ num++;
+ }
+ }
+ }
+
+ return true;
+}
+
+#include "tdefile_m3u.moc"
diff --git a/tdefile-plugins/m3u/tdefile_m3u.desktop b/tdefile-plugins/m3u/tdefile_m3u.desktop
new file mode 100644
index 00000000..388a6e71
--- /dev/null
+++ b/tdefile-plugins/m3u/tdefile_m3u.desktop
@@ -0,0 +1,71 @@
+[Desktop Entry]
+Type=Service
+Name=M3U Playlist Info
+Name[af]=M3u Liedjielys Inligting
+Name[ar]=معلومات قوائم M3U
+Name[az]=MP3 Mahnı Siyahısı İnfosu
+Name[bg]=Информация за списък M3U
+Name[bn]=এম-৩-ইউ (M3U) সঙ্গীত-তালিকা তথ্য
+Name[br]=Titouroù Rollc'hoari MP3
+Name[bs]=M3U Playlist informacije
+Name[ca]=Informació de selecció de peces M3U
+Name[cs]=Informace o seznamu skladeb M3U
+Name[cy]=Gwybodaeth Rhestr Chwarae M3U
+Name[da]=M3U-spillelisteinfo
+Name[de]=M3U-Wiedergabelisten-Info
+Name[el]=Πληροφορίες λίστας αναπαραγωγής M3U
+Name[eo]=M3U-ludlistinformo
+Name[es]=Información de lista de reproducción M3U
+Name[et]=M3U esitusnimekirja info
+Name[eu]=M3U erreprodukzio-zerrenda informazioa
+Name[fa]=اطلاعات فهرست پخش M3U
+Name[fi]=M3U-soittolistan tiedot
+Name[fr]=Informations sur une liste de lecture M3U
+Name[ga]=Eolas Seinmliosta M3U
+Name[gl]=Información de Lista M3U
+Name[he]=מידע על רשימות ניגון של M3U
+Name[hi]=M3U गीत-सूची जानकारी
+Name[hr]=Informacije o M3U listi pjesama
+Name[hu]=Az M3U lejátszási lista jellemzői
+Name[is]=M3U lagalistaupplýsingar
+Name[it]=Informazioni playlist M3U
+Name[ja]=M3U プレイリスト情報
+Name[kk]=M3U орындау тізім мәліметі
+Name[km]=ព័ត៌មាន​បញ្ជី​ចាក់ M3U
+Name[ko]=M3U 재생목록 정보
+Name[lt]=M3U gaidaraščio informacija
+Name[lv]=M3U Plejlistu Info
+Name[mk]=Информации за M3U листа со нумери
+Name[nb]=M3U spilleliste informasjon
+Name[nds]=M3U-Weddergaavlist-Info
+Name[ne]=M3U बजाउने सूची सूचना
+Name[nl]=M3U Speellijst-informatie
+Name[nn]=M3U-spelelisteinfo
+Name[pa]=M3U ਸੰਗੀਤ-ਸੂਚੀ ਜਾਣਕਾਰੀ
+Name[pl]=Informacja o liście nagrań w M3U
+Name[pt]=Informação da Lista de Músicas M3U
+Name[pt_BR]=Informações de listas de reprodução M3U
+Name[ro]=Informaţii listă M3U
+Name[ru]=Сведения о списке песен M3U
+Name[se]=M3U-čuojahanlistodieđut
+Name[sk]=Informácie o playliste M3U
+Name[sl]=Podatki o predvajalnem seznamu M3U
+Name[sr]=Информације о M3U листи нумера
+Name[sr@Latn]=Informacije o M3U listi numera
+Name[sv]=Information om M3U-spellista
+Name[ta]=M3U பாடல்பட்டியல் தகவல்
+Name[tg]=M3U Ахбороти Рӯйхати бозикуниҳо
+Name[th]=ข้อมูลรายการเพลง M3U
+Name[tr]=M3U Çalma Listesi Bilgisi
+Name[uk]=Інформація списку композицій M3U
+Name[ven]=Mavhungo a mutevhe wa tshitambi tsha M3U
+Name[xh]=M3U Ulwazi Loluhlu Lokudlala
+Name[zh_CN]=M3U 播放列表信息
+Name[zh_HK]=M3U 播放清單資訊
+Name[zh_TW]=M3U 播放清單資訊
+Name[zu]=Ulwazi Lohlu lokudlala lwe-M3U
+ServiceTypes=KFilePlugin
+X-TDE-Library=tdefile_m3u
+MimeType=audio/x-mpegurl
+PreferredGroups=Tracks
+PreferredItems=
diff --git a/tdefile-plugins/m3u/tdefile_m3u.h b/tdefile-plugins/m3u/tdefile_m3u.h
new file mode 100644
index 00000000..afc46847
--- /dev/null
+++ b/tdefile-plugins/m3u/tdefile_m3u.h
@@ -0,0 +1,40 @@
+/* This file is part of the KDE project
+ * Copyright (C) 2001, 2002 Rolf Magnus <ramagnus@kde.org>
+ *
+ * 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 version 2.
+ *
+ * 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; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ * $Id$
+ */
+
+#ifndef __KMIME_M3U_H__
+#define __KMIME_M3U_H__
+
+#include <tdefilemetainfo.h>
+#include <kurl.h>
+
+class TQStringList;
+
+class KM3uPlugin: public KFilePlugin
+{
+ Q_OBJECT
+
+
+public:
+ KM3uPlugin( TQObject *parent, const char *name, const TQStringList& args );
+
+ virtual bool readInfo( KFileMetaInfo& info, uint what );
+};
+
+#endif