summaryrefslogtreecommitdiffstats
path: root/kfile-plugins/m3u
diff options
context:
space:
mode:
Diffstat (limited to 'kfile-plugins/m3u')
-rw-r--r--kfile-plugins/m3u/Makefile.am22
-rw-r--r--kfile-plugins/m3u/kfile_m3u.cpp87
-rw-r--r--kfile-plugins/m3u/kfile_m3u.desktop71
-rw-r--r--kfile-plugins/m3u/kfile_m3u.h39
4 files changed, 219 insertions, 0 deletions
diff --git a/kfile-plugins/m3u/Makefile.am b/kfile-plugins/m3u/Makefile.am
new file mode 100644
index 00000000..d8dcb33a
--- /dev/null
+++ b/kfile-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 = kfile_m3u.h
+
+kde_module_LTLIBRARIES = kfile_m3u.la
+
+kfile_m3u_la_SOURCES = kfile_m3u.cpp
+kfile_m3u_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN)
+kfile_m3u_la_LIBADD = $(LIB_KSYCOCA)
+
+# let automoc handle all of the meta source files (moc)
+METASOURCES = AUTO
+
+messages: rc.cpp
+ $(XGETTEXT) kfile_m3u.cpp -o $(podir)/kfile_m3u.pot
+
+services_DATA = kfile_m3u.desktop
+servicesdir = $(kde_servicesdir)
diff --git a/kfile-plugins/m3u/kfile_m3u.cpp b/kfile-plugins/m3u/kfile_m3u.cpp
new file mode 100644
index 00000000..f6003667
--- /dev/null
+++ b/kfile-plugins/m3u/kfile_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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * $Id$
+ */
+
+#include "kfile_m3u.h"
+
+#include <kdebug.h>
+#include <kurl.h>
+#include <kprocess.h>
+#include <klocale.h>
+#include <kgenericfactory.h>
+
+#include <qcstring.h>
+#include <qfile.h>
+#include <qtextstream.h>
+#include <qdatetime.h>
+#include <qdict.h>
+#include <qvalidator.h>
+
+typedef KGenericFactory<KM3uPlugin> M3uFactory;
+
+K_EXPORT_COMPONENT_FACTORY( kfile_m3u, M3uFactory( "kfile_m3u" ) )
+
+KM3uPlugin::KM3uPlugin( QObject *parent, const char *name,
+ const QStringList &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, QVariant::String, 0);
+}
+
+bool KM3uPlugin::readInfo( KFileMetaInfo& info, uint )
+{
+ if ( info.path().isEmpty() ) // remote file
+ return false;
+
+ QFile f(info.path());
+ if (!f.open(IO_ReadOnly)) return false;
+ QTextStream str(&f);
+ str.setEncoding(QTextStream::Locale);
+
+
+ KFileMetaInfoGroup group = appendGroup(info, "Tracks");
+
+ // for now treat all lines that don't start with # like entries
+ int num = 1;
+ while (!str.atEnd())
+ {
+ QString 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 "kfile_m3u.moc"
diff --git a/kfile-plugins/m3u/kfile_m3u.desktop b/kfile-plugins/m3u/kfile_m3u.desktop
new file mode 100644
index 00000000..aedd958a
--- /dev/null
+++ b/kfile-plugins/m3u/kfile_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-KDE-Library=kfile_m3u
+MimeType=audio/x-mpegurl
+PreferredGroups=Tracks
+PreferredItems=
diff --git a/kfile-plugins/m3u/kfile_m3u.h b/kfile-plugins/m3u/kfile_m3u.h
new file mode 100644
index 00000000..4a25cf54
--- /dev/null
+++ b/kfile-plugins/m3u/kfile_m3u.h
@@ -0,0 +1,39 @@
+/* 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * $Id$
+ */
+
+#ifndef __KMIME_M3U_H__
+#define __KMIME_M3U_H__
+
+#include <kfilemetainfo.h>
+#include <kurl.h>
+
+class QStringList;
+
+class KM3uPlugin: public KFilePlugin
+{
+ Q_OBJECT
+
+public:
+ KM3uPlugin( QObject *parent, const char *name, const QStringList& args );
+
+ virtual bool readInfo( KFileMetaInfo& info, uint what );
+};
+
+#endif