delete files

Barna Daniel daniel.barna at cern.ch
Wed Aug 25 09:16:29 UTC 2010


Hi,
I wrote a small script, attached, to do this job using the dbus interface 
of amarok. Binding this script to a global shortcut key I can simply 
delete the currently playing file with this shortcut even if I am working 
on another desktop, in another window.


On Fri, 6 Aug 2010, Myriam Schweingruber wrote:

> On Fri, Aug 6, 2010 at 00:17, Leo Franchi <lfranchi at kde.org> wrote:
>> On Thu, Aug 5, 2010 at 5:09 PM, Barna Daniel <daniel.barna at cern.ch> wrote:
>>> Hi,
>>>
>>> I see. I tend to believe that I know what I am doing (most of the time), so
>>> I would be happy having this feature. Maybe a global config option could
>>> allow deleting files, which is disabled by default, + a confirmation dialog.
>>>
>>> Now I have to right-click, edit track details, copy the file location, then
>>> open a terminal, and paste 'rm' and the filename there. Quite annoying.
>>
>> You can no longer delete files from the playlist context menu. This is
>> because the playlist is not designed for managing tracks, that's what
>> the collection browser is for.
>>
>> When I right click a track in the collection browser, i can delete
>> files: http://imagebin.ca/view/2V199-G.html
>
> So when right-clicking in the Playlist and choosing "Show in Media
> Sources" you should be able to see the track in the Collection Browser
> and delete it from there. This is at least a feature in Amarok 2.3.1,
> not sure for 2.3.0 though.
>
>
> Regards, Myriam.
>
> -- 
> Protect your freedom and join the Fellowship of FSFE:
> http://www.fsfe.org
> Please don't send me proprietary file formats,
> use ISO standard ODF instead (ISO/IEC 26300)
>
-------------- next part --------------
#!/bin/sh

trackno=`qdbus org.kde.amarok /TrackList org.freedesktop.MediaPlayer.GetCurrentTrack 2>&1`
if [ $? = 0 ] ; then
  file=`qdbus org.kde.amarok /TrackList org.freedesktop.MediaPlayer.GetMetadata $trackno|awk '$1=="location:" {print $2}'|sed 's/%20/ /g'|sed 's/file:\/\///g'`
  kdialog --geometry 800x400 --yesno "Do you want to permanently delete the file from the disk '$file'?"
  if [ $? = 0 ] ; then
    rm -f "$file"
    qdbus org.kde.amarok /Player org.freedesktop.MediaPlayer.Next
    qdbus org.kde.amarok /TrackList org.freedesktop.MediaPlayer.DelTrack $trackno
  fi
else
  kdialog --sorry 'Amarok does not seem to be running'
fi


More information about the Amarok mailing list