Patch to allow catalog selection with Ampache database
A feature packed DJ console and internet radio client for Linux users
Status: Beta
Brought to you by:
s-fairchild
Here is a patch to allow selection of which Ampache catalog(s) to view in the Browse view. This version does not save the selected catalogs between sessions, so when you restart IDJC the view defaults to all catalogs. Also, by design, the catalogs selected in the Browse view are not honored in the Search view.
The Catalog button will only appear on the Browse tab, and will not be shown if you are using a P3 database (it doesn't support the idea of catalogs). It also will not be shown if you only have one catalog in your Ampache database.
Catalogs should be in its own tab due to its relevance to both Browse and Search. The catalog tab is where the file path transformations should be entered on a catalog by catalog basis. Ultimately each catalog should have the option to download using login details located in Prefs. This makes the use of Ampache remote catalogs a practical possibility. No need to mount with NFS/Samba but plenty of need for the user to be patient as stuff downloads.
I can see doing the catalogs in a seperate tab. I personally liked the idea to be able to do a search without the catalog selection being enforced, but I had been thinking it may be better to enforce the catalog selection.
I hadn't thought about remote catalogs, as I don't use them, and my bandwidth wouldn't allow for it.....
Unless you are planning on working on this, I'll start work on moving the catalog selection to a seperate tag.
I plan on looking at this at the weekend.
I will use a flat list gtk.TreeView with editable cells for the path transformation stuff. The path transformations can be applied at drag/drop time so changing one won't require a database update. The displayed paths will have the heading 'Remote path' rather than 'Path'. Naturally the path transformation facility in the Prefs will be obsolete.
IIRC the catalog table contains a large random ID number which can be used as a key for saving and obsoleting the saved data.
At least in my version of Ampache (3.5.4 which I know is old and the version I have on my Fedora VB 3.6alpha6), there is no random ID number, other than the catalog number.
How to you plan on reloading the database when selecting a different catalog? (not worrying about the transformations). When I started on my version, I had considered having it linked to the click events with the CheckButton. I decided against this because it could cause lots of reloads if switching more than one catalog (for example, my music in my a Music catalog and an Overflow catalog [2 different external drives]). I have another catalog with Riley's Believe It Or Not and am using my new code to be able to just show Ripley's. If using the CheckButton bindings, this could cause 3 reloads.
I guess one method would be to always load the complete database, and include the catalog ID and filter by that, instead of letting MySQL do the filtering.
BTW, while you are working on some changes, there is something else (sorta related to this change). That would be the ablility to Drag n Drop from the Browse tab to an Effects button. This would be real handy for me, as I play the Ripleys as Effects. (I have almost 400 of them). I also have another catalog of Old Radio ads (about 200 of those) that I also play as Effects. I was even thinking of adding my normal Jingles as a catalog in Ampache so I could do this.
Thanks for working on this!
You probably will notice that I just supplied a patch to enable DnD from the Browse tab to an effect button.
I plan on reloading the database upon the user switching back to the browse tab provided a different catalog selection is made. No need to reload at all if the user doesn't use browse mode.
It looks like I didn't remember correctly but the catalog id will do fine.
Thanks for the DnD patch.
The database viewer now has a "Catalogs" tab (not functional yet). The work has been pushed to the feat/catalogs branch.
Looks nice, much better than my attempt using a dialog window.
I just need to fix Prokyon and add a save feature for the catalog checkbuttons. I will probably save that info on the database. It's not much of a big deal.
If you are using a separate music file server there is no longer any need to enter path transformation info. It is computed for you using data from the nfs/Samba/cifs mounts.
Works good here with Ampache.
Feature complete and merged into master.
I see 2 problems with the latest version.
1) you can no longer have no password for the database, if the password is left blank, it defaults to ampache
2) The automatic path transformation gets confused if the ampache database is not on the same system where the music files are. For example, I have my database and files on system dalek.local, but I also have a clone of the database on themaster.millham.net. IDJC is used on cyberman.local, and the drives are fstab mounted so they look exactly the same as they do on dalek.local. Using the database on dalek.local works fine, but using the database on themaster does not work. I can connect and see the catalog selections, but the auto transform gets confused and will not allow me to select a catalog. Possibly in this instance allow the automatic transformation (which is really failing and just showing -) to be overridden. The real problem is that the assumption is made the the database server is also the file server, and that may not be the case. The other DJ on my station (that uses IDJC) uses the database on the request server as his main ampache database, he has no local copy (he doesn't want to have to run a script to keep the databases syncronized)
Other than those issues, everything looks good.
I do have one suggestion for an enhancement, allowing to choose either starting with the last selected catalog(s) or, always starting with a default catalog. (or possibly even starting with no catalogs selected).
Fixed the inability to sign in with a blank password. The path transformations are now done on a per catalog basis similar to the old way.
Last edit: Stephen Fairchild 2014-02-13