Bug 242292 - Split the .desktop file so the InitialPreference can be set in a better way
Summary: Split the .desktop file so the InitialPreference can be set in a better way
Status: RESOLVED FIXED
Alias: None
Product: amarok
Classification: Applications
Component: general (show other bugs)
Version: 2.3.0
Platform: openSUSE Linux
: NOR wishlist
Target Milestone: ---
Assignee: Amarok Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-20 20:50 UTC by Christian Morales Vega
Modified: 2010-07-09 10:38 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 2.3.2


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Morales Vega 2010-06-20 20:50:59 UTC
Version:           2.3.0 (using KDE 4.4.4) 
OS:                Linux

Distributions have to define the default applications, KDE allows that using the InitialPreference key in .desktop files. But that preference applies to all the MIME types registered in that .desktop file, you can't set a high preference for audio/mpeg and a low preference to audio/mp4.
This is a problem because if I set a higher preference to Kaffeine than to Amarok Kaffeine will be the default video player, but also the default audio player. So I just need to set Kaffeine with a lower preference? No, because now Amarok is the default application for container formats... and in cases where I only know the container format but no its contents I should use the most generic media player (kaffeine, that also plays videos).

So, to allow for a finer preference selection it would help that you split the .desktop file in multiple files in the same way Okular already does. There would be a single main .desktop file, but then would be also
- amarokContainers.desktop
- amarokAudio.desktop
- amarokPlaylist.desktop
files, with "NoDisplay=true", that would allow to select the preference independently.

I said container formats, audio formats and playlist formats; but there could be more. Every different "concept"/"idea" should be in a different .desktop file.

Reproducible: Always
Comment 1 Kevin Funk 2010-07-08 16:21:52 UTC
Why not provide a patch as you are already familiar with this? Would help us a lot.
Comment 2 Christian Morales Vega 2010-07-08 16:41:35 UTC
Well, the exact splitting is something that is subject to different opinions.

At openSUSE we have this patch: https://build.opensuse.org/package/view_file?file=initial-preference.diff&package=amarok&project=KDE%3ADistro%3AFactory

It basically adds "InitialPreference=5" to the desktop file so Amarok is the default application (ok for a distro, don't know if you want to/should add it) and creates a copy ("amarokNoAudio.desktop") with video/x-ms-asf and application/ogg, and "NoDisplay=true".

So the splitting done at openSUSE is:
- MIME types than can contain only audio plus audio/mpegurl and audio/x-scpls (playlist formats that could contain video but usually? don't)
- Container formats that can contain video (ASF and OGG).

This way we can set Amarok as the default application only for audio-only files (while Kaffeine is the default when the file could/will also contain video).

If no one else complains you could use the patch without changes. But perhaps someone wants/needs a different splitting.
Comment 3 Kevin Funk 2010-07-08 17:36:36 UTC
	A	 src/amarok_containers.desktop	 [License: Trivialfile.]

commit fb79ce94bcf0d9d7bd9cd334c2a7bbd2517f14e6
Author: Kevin Funk <krf@electrostorm.net>
Date:   Thu Jul 8 17:35:34 2010 +0200

    Split desktop files so that audio and container formats can be handled
    separately.
    BUG: 242292

diff --git a/ChangeLog b/ChangeLog
index 8babebb..338d228 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -32,6 +32,8 @@ VERSION 2.3.2-Beta 1
       Patch by Richard Longland <rlongland@hotmail.com>.
 
   BUGFIXES:
+    * Splitted desktop so mime types can be allocated in a better way
+      (BR 242292).
     * Fixed some tracks not being scanned when they had corrupted MusicBrainz
       IDs. Thanks to MatÄj Laitl <matej@laitl.cz> for the patch. (BR 236227)
     * Fixed crash when navigating using "Places" in the file browser. (BR 240338)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 71b784b..23436ef 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -891,13 +891,18 @@ endif(Q_WS_MAC)
 ########### install files ###############
 
 install(FILES amarok.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} )
+install(FILES amarok_containers.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} )
+
 install(FILES amarok_plugin.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR})
 install(FILES amarok_codecinstall.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR})
 install(FILES amarok_append.desktop DESTINATION ${SERVICES_INSTALL_DIR}/ServiceMenus)
 install(FILES amarok-play-audiocd.desktop DESTINATION ${DATA_INSTALL_DIR}/solid/actions)
+
 install(FILES amarok.knsrc DESTINATION ${CONFIG_INSTALL_DIR})
 install(FILES context/amarokapplets.knsrc DESTINATION ${CONFIG_INSTALL_DIR})
 
+# protocol handlers
+install(FILES amarokurls/amarok.protocol  DESTINATION  ${SERVICES_INSTALL_DIR})
 install(FILES amarokitpc.protocol DESTINATION ${SERVICES_INSTALL_DIR})
 #install(FILES amarokpcast.protocol DESTINATION ${SERVICES_INSTALL_DIR})
 
@@ -923,9 +928,3 @@ install( FILES data/amarok_homerc DESTINATION ${CONFIG_INSTALL_DIR} )
 install( FILES data/amarok.notifyrc DESTINATION ${DATA_INSTALL_DIR}/amarok )
 
 kde4_install_icons( ${ICON_INSTALL_DIR} )
-
-############ amarok protocol handler ###########
-
-install( FILES amarokurls/amarok.protocol  DESTINATION  ${SERVICES_INSTALL_DIR} )
-
-
diff --git a/src/amarok.desktop b/src/amarok.desktop
index 19403b2..55f1f75 100644
--- a/src/amarok.desktop
+++ b/src/amarok.desktop
@@ -174,7 +174,9 @@ Comment[x-test]=xxAmarok - Rediscover Your Music!xx
 Comment[zh_CN]=Amarok - éæ°åç°æ¨çé³ä¹ï¼
 Comment[zh_TW]=Amarok - éæ°æ¢ç´¢æ¨çé³æ¨ä¸çï¼
 Icon=amarok
-MimeType=audio/aac;audio/mp4;audio/mpeg;audio/mpegurl;audio/vnd.rn-realaudio;audio/vorbis;audio/x-flac;audio/x-mp3;audio/x-mpegurl;audio/x-ms-wma;audio/x-musepack;audio/x-oggflac;audio/x-pn-realaudio;audio/x-scpls;audio/x-speex;audio/x-vorbis;audio/x-wav;video/x-ms-asf;application/x-ogm-audio;audio/x-vorbis+ogg;application/ogg;audio/ogg;x-content/audio-player;x-content/audio-cdda;
+# Add pure audio formats here, for other formats see amarok_*.desktop files
+# See bug 242292
+MimeType=audio/aac;audio/mp4;audio/mpeg;audio/mpegurl;audio/vnd.rn-realaudio;audio/vorbis;audio/x-flac;audio/x-mp3;audio/x-mpegurl;audio/x-ms-wma;audio/x-musepack;audio/x-oggflac;audio/x-pn-realaudio;audio/x-scpls;audio/x-speex;audio/x-vorbis;audio/x-wav;application/x-ogm-audio;audio/x-vorbis+ogg;audio/ogg;
 X-DocPath=amarok/index.html
 X-KDE-Keywords=music,podcast
 X-KDE-Protocols=http
diff --git a/src/amarok_containers.desktop b/src/amarok_containers.desktop
new file mode 100644
index 0000000..ca07814
--- /dev/null
+++ b/src/amarok_containers.desktop
@@ -0,0 +1,184 @@
+[Desktop Entry]
+Type=Application
+Version=1.0
+Name=Amarok
+Name[be]=Amarok
+Name[bg]=Amarok
+Name[ca]=Amarok
+Name[ca@valencia]=Amarok
+Name[cs]=Amarok
+Name[csb]=Amarok
+Name[da]=Amarok
+Name[de]=Amarok
+Name[el]=AmaroK
+Name[en_GB]=Amarok
+Name[eo]=Amarok
+Name[es]=Amarok
+Name[et]=Amarok
+Name[eu]=Amarok
+Name[fi]=Amarok
+Name[fr]=Amarok
+Name[ga]=Amarok
+Name[gl]=Amarok
+Name[he]=Amarok
+Name[hi]=à¤à¤®à¤¾à¤°à¥à¤
+Name[hne]=à¤à¤®à¤¾à¤°à¤¾à¤
+Name[hu]=Amarok
+Name[is]=Amarok
+Name[it]=Amarok
+Name[ja]=Amarok
+Name[km]=Amarok
+Name[ko]=Amarok
+Name[ku]=Amarok
+Name[lt]=Amarok
+Name[lv]=Amarok
+Name[ms]=Amarok
+Name[nb]=Amarok
+Name[nds]=Amarok
+Name[ne]=à¤à¤®à¤¾à¤°à¥à¤
+Name[nl]=Amarok
+Name[nn]=Amarok
+Name[oc]=Amarok
+Name[pa]=à¨à¨®à¨°à©à¨
+Name[pl]=Amarok
+Name[pt]=Amarok
+Name[pt_BR]=Amarok
+Name[ro]=Amarok
+Name[ru]=Amarok
+Name[sk]=Amarok
+Name[sl]=Amarok
+Name[sr]=ÐмаÑок
+Name[sr@ijekavian]=ÐмаÑок
+Name[sr@ijekavianlatin]=Amarok
+Name[sr@latin]=Amarok
+Name[sv]=Amarok
+Name[th]=à¹à¸­à¸¡à¸­à¸°à¸£à¹à¸­à¸
+Name[tr]=Amarok
+Name[uk]=Amarok
+Name[wa]=Amarok
+Name[x-test]=xxAmarokxx
+Name[zh_CN]=Amarok
+Name[zh_TW]=Amarok
+GenericName=Audio Player
+GenericName[be]=ÐÑдÑÑпÑайгÑавалÑнÑк
+GenericName[bg]=ÐÑдио плеÑÑ
+GenericName[ca]=Reproductor d'àudio
+GenericName[ca@valencia]=Reproductor d'àudio
+GenericName[cs]=Zvukový pÅehrávaÄ
+GenericName[csb]=Grôcz aùdio
+GenericName[da]=Lydafspiller
+GenericName[de]=Medienwiedergabe
+GenericName[el]=ÎναÏαÏαγÏγή ήÏοÏ
+GenericName[en_GB]=Audio Player
+GenericName[eo]=Sonludilo
+GenericName[es]=Reproductor de audio
+GenericName[et]=Helifailide mängija
+GenericName[eu]=Audio erreproduzigailua
+GenericName[fi]=Musiikkisoitin
+GenericName[fr]=Lecteur audio
+GenericName[ga]=Seinnteoir Fuaime
+GenericName[gl]=Reprodutor de audio
+GenericName[he]=× ×× ×©××¢
+GenericName[hne]=à¤à¤¡à¤¿à¤¯à¥ पà¥à¤²à¥à¤¯à¤°
+GenericName[hu]=Zenelejátszó
+GenericName[is]=Tónlistarspilari
+GenericName[it]=Lettore audio
+GenericName[ja]=ãªã¼ãã£ãªãã¬ã¼ã¤ã¼
+GenericName[km]=áááááá·áá¸âáá¶ááâá¢á¼áá¸ááá¼
+GenericName[ko]=ì¤ëì¤ ì¬ì기
+GenericName[ku]=Lêdarê Muzîkê
+GenericName[lt]=Muzikos grotuvas
+GenericName[lv]=Audio atskaÅotÄjs
+GenericName[mai]=à¤à¤¡à¤¿à¤¯à¥ पà¥à¤²à¥à¤¯à¤°
+GenericName[ms]=Pemain Audio
+GenericName[nb]=Lydavspiller
+GenericName[nds]=Klangafspeler
+GenericName[ne]=à¤à¤¡à¤¿à¤¯à¥ पà¥à¤²à¥à¤¯à¤°
+GenericName[nl]=Audiospeler
+GenericName[nn]=Musikkspelar
+GenericName[pa]=à¨à¨¡à©à¨ ਪਲà©à¨à¨°
+GenericName[pl]=Odtwarzacz audio
+GenericName[pt]=Leitor de Ãudio
+GenericName[pt_BR]=Reprodutor de Ãudio
+GenericName[ro]=Redare audio
+GenericName[ru]=ÐÑдио пÑоигÑÑваÑелÑ
+GenericName[sk]=Audio prehrávaÄ
+GenericName[sl]=Predvajalnik glasbe
+GenericName[sr]=ÐÑдио плеÑеÑ
+GenericName[sr@ijekavian]=ÐÑдио плеÑеÑ
+GenericName[sr@ijekavianlatin]=Audio plejer
+GenericName[sr@latin]=Audio plejer
+GenericName[sv]=Ljudspelare
+GenericName[th]=à¹à¸à¸£à¸·à¹à¸­à¸à¹à¸¥à¹à¸à¹à¸ªà¸µà¸¢à¸
+GenericName[tr]=Müzik Ãalar
+GenericName[uk]=ÐÑдÑопÑогÑаваÑ
+GenericName[wa]=Djouweu d' son
+GenericName[x-test]=xxAudio Playerxx
+GenericName[zh_CN]=é³é¢æ­æ¾å¨
+GenericName[zh_TW]=é³ææ­æ¾å¨
+Exec=amarok %U
+Comment=Amarok - Rediscover Your Music!
+Comment[be]=Amarok - адкÑÑйÑе Ð´Ð»Ñ ÑÑбе ÑÐ²Ð°Ñ Ð¼ÑзÑкÑ!
+Comment[bg]=Amarok - пÑеоÑкÑийÑе мÑзикаÑа!
+Comment[ca]=Amarok - Redescobreix la teva música!
+Comment[ca@valencia]=Amarok - Redescobreix la teva música!
+Comment[cs]=AmaroK - znovu objevte svou hudbu!
+Comment[csb]=Amarok - òdrëjë znowa swòjÄ mùzykã
+Comment[da]=Amarok - Genopdag din musik!
+Comment[de]=Amarok - Musik neu erleben!
+Comment[el]=Amarok - ÎαναανακαλήÏÏε Ïη μοÏÏική ÏαÏ!
+Comment[en_GB]=Amarok - Rediscover Your Music!
+Comment[eo]=Amarok - Remalkovru vian muzikon!
+Comment[es]=Amarok - ¡Vuelve a descubrir tu música!
+Comment[et]=Amarok - naudi oma muusikat!
+Comment[eu]=Amarok - Biraurkitu zure musika!
+Comment[fi]=Amarok â löydä musiikkisi uudelleen
+Comment[fr]=Amarok - Redécouvrez votre musique !
+Comment[ga]=Amarok - Athaimsigh do chuid Ceoil!
+Comment[gl]=Amarok - Descubra de novo a música!
+Comment[he]=Amarok - ××× ×××ש ×ת ×××××ק×
+Comment[hne]=à¤à¤®à¤¾à¤°à¤¾à¤ - à¤à¤ªà¤¨ सà¤à¤à¥à¤¤ ल फिर सॠà¤à¥à¤à¤µ!
+Comment[hu]=Amarok - fedezze fel a zenéjét
+Comment[is]=Amarok - Enduruppgötvaðu tónlistina þína!
+Comment[it]=Amarok - Riscopri la tua musica!
+Comment[ja]=Amarok - ããªãã®é³æ¥½ãåçºè¦
+Comment[km]=Amarok - áááá¾áâááááááá¸âááááâá¢áááâá¡á¾áâáá·á !
+Comment[ko]=Amarok - ììì ì¬ë°ê²¬!
+Comment[ku]=Amarok - muzîkê ji nû ve keÅif bike
+Comment[lt]=Amarok â atraskite savo muzikÄ iÅ¡ naujo!
+Comment[lv]=Amarok - atklÄj savu mÅ«ziku!
+Comment[ms]=Amarok - Temui Muzik Anda!
+Comment[nb]=Amarok â Oppdag musikken din pÃ¥ nytt!
+Comment[nds]=Amarok - Beleev Dien Musik nieg!
+Comment[ne]=à¤à¤®à¤¾à¤°à¥à¤ - à¤à¤«à¥à¤¨à¥ बाà¤à¤¾ फà¥à¤°à¤¿ पतà¥à¤¤à¤¾ लà¤à¤¾à¤à¤¨à¥à¤¹à¥à¤¸à¥!
+Comment[nl]=Amarok - Herontdek uw muziek!
+Comment[nn]=Amarok â gjenoppdag musikken din!
+Comment[pa]=à¨à¨®à¨°à©à¨ - à¨à¨ªà¨£à¨¾ ਸੰà¨à©à¨¤ ਮà©à© ਲੱਭà©!
+Comment[pl]=Amarok - odkryj na nowo swojÄ muzykÄ!
+Comment[pt]=Amarok - Descubra de Novo a sua Música!
+Comment[pt_BR]=Amarok - Redescubra Sua Música!
+Comment[ro]=Amarok - RedescoperÄ-Èi muzica!
+Comment[ru]=Amarok - поÑмоÑÑиÑе на мÑзÑÐºÑ Ð¿Ð¾-дÑÑгомÑ
+Comment[sk]=Amarok - Znova objavte svoju hudbu!
+Comment[sl]=Amarok - Znova odkrijte svojo glasbo!
+Comment[sr]=ÐмаÑок â оÑкÑиÑÑе ÑвоÑÑ Ð¼ÑзикÑ!
+Comment[sr@ijekavian]=ÐмаÑок â оÑкÑиÑÑе ÑвоÑÑ Ð¼ÑзикÑ!
+Comment[sr@ijekavianlatin]=Amarok â otkrijte svoju muziku!
+Comment[sr@latin]=Amarok â otkrijte svoju muziku!
+Comment[sv]=Amarok - Ãterupptäck din musik!
+Comment[th]=à¹à¸­à¸¡à¸­à¸°à¸£à¹à¸­à¸ - à¸à¹à¸à¸à¸à¸¡à¸´à¸à¸´à¹à¸«à¸¡à¹à¹à¸à¸à¸à¸à¸£à¸µà¸à¸­à¸à¸à¸¸à¸ !
+Comment[tr]=Amarok - MüziÄinizi yeniden keÅfedin!
+Comment[uk]=Amarok â вÑдкÑийÑе ÑÐ²Ð¾Ñ Ð¼ÑÐ·Ð¸ÐºÑ Ð·Ð½Ð¾Ð²Ñ!
+Comment[wa]=Amarok - Ridiscovroz vosse muzike!
+Comment[x-test]=xxAmarok - Rediscover Your Music!xx
+Comment[zh_CN]=Amarok - éæ°åç°æ¨çé³ä¹ï¼
+Comment[zh_TW]=Amarok - éæ°æ¢ç´¢æ¨çé³æ¨ä¸çï¼
+Icon=amarok
+# Add container formats here
+MimeType=video/x-ms-asf;application/ogg;
+NoDisplay=true
+X-DocPath=amarok/index.html
+X-KDE-Keywords=music,podcast
+X-KDE-Protocols=http
+Terminal=false
+Categories=Qt;KDE;AudioVideo;Audio;Player;
Comment 4 Kevin Funk 2010-07-08 17:37:11 UTC
Thanks for your detailled info about this, Christian.