This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Refresh Collection

Tags: None
(comma "," separated)
gigerk
Registered Member
Posts
5
Karma
0
OS

Refresh Collection

Mon Aug 24, 2009 10:23 pm
Hi there,
I was writing a very small script which removes items from the 'tracks' table that are no longer available. Is there a way to tell Amarok to refresh its collection in the GUI (i.e. main application window)? Otherwise I have to restart the program... :-( Or is there a way how my script could be initialized before the collection is read for populating the GUI?
I hope you understand my problem. I'm looking forward to read from you and thank you in advance!
Kaspar
User avatar
Dieter Schroeder
Registered Member
Posts
714
Karma
7
OS

Re: Refresh Collection

Tue Aug 25, 2009 3:14 pm
Which Amarok version?
Are you talking about manipulating the database?

m0nk
gigerk
Registered Member
Posts
5
Karma
0
OS

Re: Refresh Collection

Tue Aug 25, 2009 3:37 pm
I'm using 2.0.2.

Yes, manipulated the database, because Amarok didn't it by itself... Whenever a certain device is not mounted, I don't want to appear files originating from this device in my collection. So I backed up the whole 'track' table to a temporary table and then erased the entries in the 'track' table whose url.rpath start with './mnt/blablabla'. Maybe it's not really the way how one should solve the problem, so if I should solve it otherwise please tell me!

Well, but the problem now was, that the changes in the 'track' table only showed up when I relaunched Amarok...
User avatar
Mamarok
Manager
Posts
6071
Karma
16
OS

Re: Refresh Collection

Tue Aug 25, 2009 3:58 pm
gigerk wrote:I'm using 2.0.2.

You should start with upgrading to Amarok 2.1.1, version 2.0.2 is quite old and outdated.


Running Kubuntu 22.10 with Plasma 5.26.3, Frameworks 5.100.0, Qt 5.15.6, kernel 5.19.0-23 on Ryzen 5 4600H, AMD Renoir, X11
FWIW: it's always useful to state the exact Plasma version (+ distribution) when asking questions, makes it easier to help ...
gigerk
Registered Member
Posts
5
Karma
0
OS

Re: Refresh Collection

Tue Aug 25, 2009 4:00 pm
Does it solve the problem?

(I read in other forums that I'm not the only one having it, so I wanted to find a solution and though contribute a bit to Amarok ;-) ).
User avatar
Mamarok
Manager
Posts
6071
Karma
16
OS

Re: Refresh Collection

Tue Aug 25, 2009 4:30 pm
Well, if you want to contribute by scripts you should check our scripting guide here:

http://amarok.kde.org/scripting

Also we are currently preparing the 2.2 release, the best would be to come by in #amarok on irc.freenode.net, the forum is not exactly the best place right now, as everybody is busy with coding, on IRC the devs are more easily available. I will ping someone to this thread, too.


Running Kubuntu 22.10 with Plasma 5.26.3, Frameworks 5.100.0, Qt 5.15.6, kernel 5.19.0-23 on Ryzen 5 4600H, AMD Renoir, X11
FWIW: it's always useful to state the exact Plasma version (+ distribution) when asking questions, makes it easier to help ...
gigerk
Registered Member
Posts
5
Karma
0
OS

Re: Refresh Collection

Tue Aug 25, 2009 4:36 pm
Thanks for your fast replies! I really appreciate it!

I already read through your excellent guide, as well as the database schema and the class definition of Amarok. Unfortunately the solution was not there. Well, I will try my best to find a good solution.

By the way: Do you think such a feature should be inside a script or "hardcoded" in the Amarok source?
User avatar
Dieter Schroeder
Registered Member
Posts
714
Karma
7
OS

Re: Refresh Collection

Tue Aug 25, 2009 5:09 pm
Amarok takes care of updating the database by itself.
2.0.2 lost/destroyed the db, but that is solved in 2.1.
It's generally no good idea to manipulate the db from outside amarok,
(although I do it for calculating my stats. But pssst!).
Removable devices and net shares are the problem, I see.
So if you have solutions how to handle not always mounted NFS-Shares or external HDDs on a laptop f.e., you're highly appreciated.

m0nk


If men could get pregnant, abortion would be a sacrament.
gigerk
Registered Member
Posts
5
Karma
0
OS

Re: Refresh Collection

Tue Aug 25, 2009 5:17 pm
ok, so maybe I'm on the wrong path to fix this with a script. My idea (that's what I've implemented for my external USB HD so far) was to have a backup table of 'tracks'. Whenever Amarok is started the script replaces 'tracks' by the backup table and checks if the device is mounted (by using QDir). If not, all entries in 'tracks' are removed which point to a file on the external drive. Well, maybe it's too naive, but it works for me :)


Bookmarks



Who is online

Registered users: Bing [Bot], gfielding, Google [Bot], markhm, Sogou [Bot], Yahoo [Bot]