Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ampache #91

Merged
merged 1 commit into from
Mar 24, 2014
Merged

Ampache #91

merged 1 commit into from
Mar 24, 2014

Conversation

MorrisJobke
Copy link
Contributor

Non-Data Methods

  • handshake
    • timestamp (Timestamp used in seed of password hash)
    • auth (Timestamp . Password SHA hash)
    • version (API Version that the application understands)
    • username
  • ping
    • auth (Session ID is optional) returns version information and extends the session if passed

Data Methods

  • artists
    • filter (Value is Alpha Match for returned results, may be more then one letter/number)
    • exact (Boolean, if true filter is exact rather then fuzzy)
  • artist_songs
    • filter (UID of Artist, returns song XML)
  • artist_albums
    • filter (UID of Artist, returns Album XML)
  • albums
    • filter (Value is Alpha Match for returned results, may be more then one letter/number)
    • exact (Boolean, if true filter is exact rather then fuzzy)
  • album_songs
    • filter (UID of Album, returns song XML)
  • songs
    • filter (Value is Alpha Match for returned results, may be more then one letter/number)
    • exact (Boolean, if true filter is exact rather then fuzzy)
  • song
    • filter (UID of Song, returns song XML)
  • search_songs
    • filter (Value is Alpha Match for Song Title, Artist Name, Album Name, Genre Name returns song XML)

For artists, albums and songs are following additional arguments possible but they are not represented in the current data model:

  • add (ISO 8601 Date Format assumed filter method is newer then specified date, however [START]/[END] can be specified to receive only results added between two dates)
  • update (ISO 8601 Date Format assumed filter method is newer then specified date, however [START]/[END] can be specified to receive only results updated between two dates)

Postponed queries

See #160

@MorrisJobke MorrisJobke mentioned this pull request Sep 16, 2013
@karlitschek
Copy link

sweet

* It reads out the annotations of a controller method and checks which if
* ampache authentification stuff has to be done.
*/
class AmpacheMiddleware extends Middleware {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice show case for middleware usage! I'll add a public API for middleware handling

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! I also have a custom middleware that I would love to still be able to use.

@MorrisJobke
Copy link
Contributor Author

I added settings to enable/disable ampache support ... for admins and users

@karlitschek
Copy link

nice

@MorrisJobke
Copy link
Contributor Author

It generates the password hashes used by the Ampache API - and also clears them if ampache gets disabled. Also the handshake is working right now.

@DeepDiver1975
Copy link
Member

@kabum I just tried to connect with viridian (a pure ampache player) and it failes.

That player tries to connect like this:
/oc/core/index.php/server/xml.server.php?action=handshake&timestamp=1384462965&version=350001&user=admin&auth=f8af8367d1b2b67f907b7d0681d44fbe1c9a0ecc9e81a12aa8577c8cbc124c2c

@DeepDiver1975
Copy link
Member

same for amarok ....

@MorrisJobke
Copy link
Contributor Author

Use core/index.php/apps/music/ampache/

@MorrisJobke
Copy link
Contributor Author

  • fixed error with enabled short tags in PHP
  • remove PHP Notice in the ampache middleware
  • rebased on master

@jancborchardt
Copy link
Member

@kabum anything left to do or ready for review?

@MorrisJobke
Copy link
Contributor Author

@jancborchardt Many left to do ... but not enough time. I've focused on core in the last weeks

@jancborchardt
Copy link
Member

Yeah, no worries. Just went through pull requests. :)

@MorrisJobke
Copy link
Contributor Author

@fossxplorer I just tested this branch with tomahawk and it shows up in tomahawk ... just the retrieving of further track data isn't implemented. Will look into it tomorrow :)

@MorrisJobke
Copy link
Contributor Author

ampache-tomahawk

@MorrisJobke
Copy link
Contributor Author

I faced some issues: I cannot login the user because I don't have the password to log the user in. Therefore the ampache API wouldn't work if encryption is enabled. This problem can't be avoided due to the ampache protocol, which doesn't support an other way of authentication.

Workaround which should NEVER be implemented (and is therefore lined through): We could save the password in plaintext right beside the token to login the user.

We should simply deactivate the Ampache API for instances with encryption enabled.

@schiesbn: I hope I'm correct with my statements.

cc @DeepDiver1975 @butonic @karlitschek

@jancborchardt
Copy link
Member

@kabum do we need the /ampache at the end of the link?

Also, I assume the hamster icon comes from Tomahawk and the »Ampache Sammlung« text every person types in themselves? (Just saying, because I’m not sure if clients use the word »Ampache« at all and if we should hence use it so much.)

@MorrisJobke
Copy link
Contributor Author

@jancborchardt I just typed in the URL from ownCloud (looks like the "WebDAV URL" in the personal settings) and then added my credentials and all other was the default. So it's as easy as possible. BTW: The plugin in tomahawk itself is called Ampache and I just used it to see if it works ;)

@mijoharas
Copy link

could we have a separate ampache password for cases where ssl is enabled? am I neglecting to think of something? thanks for all your work on this, it's much appreciated.

@MorrisJobke
Copy link
Contributor Author

@mhauserr That sounds good, because the ampache stuff has to be actived (due to the weakening of the password hashing)

@jancborchardt What do you think?

cc @DeepDiver1975 @karlitschek @butonic Is a separate password acceptable?

@schiessle
Copy link

We should simply deactivate the Ampache API for instances with encryption enabled.

@schiesbn: I hope I'm correct with my statements.

Yes, your statements are correct. If there is no way to authenticate the user with his password than we should disable the Ampache API for now if encryption is enabled.

@Afterster
Copy link

Good to see Ampache support is a 'work in progress' to come back in OC6. Good new!
We forked Ampache project 3 months ago (https://github.com/ampache-doped/ampache) when we found out official maintainers deserted the project (or just give answer sometimes every 2 months, likely the same...). We changed a lot of things (in a good way I believe) and added several features. It's why I just added XML-API update in the roadmap (https://github.com/ampache-doped/ampache/issues/118). Nothing started yet but I think you have your opinion and I am really interested to read it. You will not be able to use it (it's a fork and you don't want to break compatible clients) but at least the improvement will be here, and who knows, maybe it will be merged to official repository one day (ampache/ampache#99).

  1. How do you see XML-API authentication process?
  2. Other improvement?

@mijoharas
Copy link

has there been a decision on how to support apache with ssl yet? is there any stuff that needs to be done to help or is there a version we can help test?

@SunboX
Copy link

SunboX commented Mar 3, 2014

any news about this?

@MorrisJobke
Copy link
Contributor Author

Rebased and amended

@MorrisJobke
Copy link
Contributor Author

I removed the Ampache setting. Users can now generate a password (one-time passwords) and revoke those. So their password isn't weaken at any time.

@MorrisJobke
Copy link
Contributor Author

Will merge that now. Now the translation guys can do their work. :)

Testing is much appreciated.

Thank you all for your patience - especially @j-ed @fossxplorer

@butonic @jancborchardt @karlitschek @DeepDiver1975 That was a hard one - not really finished during GSoC, but better later than never ;) 🚀

MorrisJobke added a commit that referenced this pull request Mar 24, 2014
@MorrisJobke MorrisJobke merged commit f9e23eb into master Mar 24, 2014
@MorrisJobke MorrisJobke deleted the ampache branch March 24, 2014 00:18
@HLFH
Copy link

HLFH commented Mar 24, 2014

@MorrisJobke Thanks a lot for your work !! But I don't arrive to generate an API password. When I type the description "Just Player" (on ownCloud "Personal" page) and click on Generate API password, the generation is loading indefinitely. So, I don't have any API password and couldn't test on Mac or Android.

@MorrisJobke
Copy link
Contributor Author

@HLFH Can you have a look at the log files? (owncloud.log in data folder, webservers log) And also check the Javascript console in your webbrowser (F12 for chrome and then "Console", Ctrl+Shift+k for Firefox) Thanks

@MorrisJobke
Copy link
Contributor Author

@HLFH Can you also specify the browser you use?

@HLFH
Copy link

HLFH commented Mar 24, 2014

@MorrisJobke

Thanks :)

Server Hardware : Intel NUC D54250WYKH
OS : ArchLinux x86-64

Client : MacBookAir mid-2011 with OS X 10.9.2 using Firefox 29.0 and Chromium 34.0

(I didn't put the right clock time on BIOS and NTP is not running for the moment)

In owncloud.log, I have several hundreds of that :

{"app":"OCP\\Share","message":"Sharing backend OCA\\Contacts\\Share\\Addressbook not registered, OCA\\Contacts\\Share\\Addressbook is already registered for addressbook","level":2,"time":"2014-03-24T17:29:03+00:00"}
{"app":"OCP\\Share","message":"Sharing backend OCA\\Contacts\\Share\\Addressbook not registered, OCA\\Contacts\\Share\\Addressbook is already registered for addressbook","level":2,"time":"2014-03-24T17:29:05+00:00"}
{"app":"OCP\\Share","message":"Sharing backend OCA\\Contacts\\Share\\Addressbook not registered, OCA\\Contacts\\Share\\Addressbook is already registered for addressbook","level":2,"time":"2014-03-24T17:29:05+00:00"}
{"app":"OCP\\Share","message":"Sharing backend OCA\\Contacts\\Share\\Addressbook not registered, OCA\\Contacts\\Share\\Addressbook is already registered for addressbook","level":2,"time":"2014-03-24T17:29:05+00:00"}
{"app":"OCP\\Share","message":"Sharing backend OCA\\Contacts\\Share\\Addressbook not registered, OCA\\Contacts\\Share\\Addressbook is already registered for addressbook","level":2,"time":"2014-03-24T17:29:05+00:00"}
{"app":"OCP\\Share","message":"Sharing backend OCA\\Contacts\\Share\\Addressbook not registered, OCA\\Contacts\\Share\\Addressbook is already registered for addressbook","level":2,"time":"2014-03-24T17:29:05+00:00"}
{"app":"OCP\\Share","message":"Sharing backend OCA\\Contacts\\Share\\Addressbook not registered, OCA\\Contacts\\Share\\Addressbook is already registered for addressbook","level":2,"time":"2014-03-24T17:29:06+00:00"}
{"app":"OCP\\Share","message":"Sharing backend OCA\\Contacts\\Share\\Addressbook not registered, OCA\\Contacts\\Share\\Addressbook is already registered for addressbook","level":2,"time":"2014-03-24T17:29:06+00:00"}
{"app":"OCP\\Share","message":"Sharing backend OCA\\Contacts\\Share\\Addressbook not registered, OCA\\Contacts\\Share\\Addressbook is already registered for addressbook","level":2,"time":"2014-03-24T17:29:06+00:00"}
{"app":"OCP\\Share","message":"Sharing backend OCA\\Contacts\\Share\\Addressbook not registered, OCA\\Contacts\\Share\\Addressbook is already registered for addressbook","level":2,"time":"2014-03-24T17:29:06+00:00"}

So, for owncloud.log, there is anything related to my Ampache issue, just an awful friendly warning.

In my favorite browser Firefox (29.0), I have that :

L'utilisation de « getPreventDefault() » est obsolète. Utiliser « defaultPrevented » à la place. core.js:50
TypeError: OC.generateUrl is not a function settings-user.js:70

In Chromium (34.0.1836.0 (250493)), I have that :

event.returnValue is deprecated. Please use the standard event.preventDefault() instead.
Uncaught TypeError: undefined is not a function settings-user.js?v=da54dd5a0398011cdfa50d559c2c0ef8:70

Nothing important to report for webservers logs :

[root@intelnuc log]# systemctl status nginx -l
nginx.service - A high performance web server and a reverse proxy server
   Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled)
   Active: active (running) since lun. 2014-03-24 18:21:58 CET; 42min ago
  Process: 295 ExecStart=/usr/bin/nginx -g pid /run/nginx.pid; daemon on; master_process on; (code=exited, status=0/SUCCESS)
  Process: 258 ExecStartPre=/usr/bin/nginx -t -q -g pid /run/nginx.pid; daemon on; master_process on; (code=exited, status=0/SUCCESS)
 Main PID: 304 (nginx)
   CGroup: /system.slice/nginx.service
           ├─304 nginx: master process /usr/bin/nginx -g pid /run/nginx.pid; daemon on; master_process on
           ├─305 nginx: worker process                                              
           ├─306 nginx: worker process                                              
           ├─307 nginx: worker process                                              
           └─308 nginx: worker process                                              

mars 24 18:21:58 intelnuc systemd[1]: Starting A high performance web server and a reverse proxy server...
mars 24 18:21:58 intelnuc systemd[1]: Started A high performance web server and a reverse proxy server.
mars 24 18:22:10 intelnuc nginx[295]: 2014/03/24 18:22:10 [error] 305#0: *1 open() "/var/www/favicon.ico" failed (2: No such file or directory), client: 192.168.1.1, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "gitnote.eu"
mars 24 18:22:10 intelnuc nginx[295]: 2014/03/24 18:22:10 [error] 305#0: *1 open() "/var/www/favicon.ico" failed (2: No such file or directory), client: 192.168.1.1, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "gitnote.eu"
mars 24 18:26:25 intelnuc nginx[295]: 2014/03/24 18:26:25 [error] 308#0: *135 open() "/var/www/owncloud/favicon.ico" failed (2: No such file or directory), client: 192.168.1.1, server: cloud.gitnote.eu, request: "GET /favicon.ico HTTP/1.1", host: "cloud.gitnote.eu"
[root@intelnuc log]# systemctl status php-fpm -l
php-fpm.service - The PHP FastCGI Process Manager
   Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; enabled)
   Active: active (running) since lun. 2014-03-24 18:21:58 CET; 43min ago
 Main PID: 263 (php-fpm)
   Status: "Processes active: 0, idle: 3, Requests: 243, slow: 0, Traffic: 0.4req/sec"
   CGroup: /system.slice/php-fpm.service
           ├─263 php-fpm: master process (/etc/php/php-fpm.conf)              
           ├─608 php-fpm: pool www                                            
           ├─710 php-fpm: pool www                                            
           └─796 php-fpm: pool www                                            

mars 24 18:21:58 intelnuc systemd[1]: Started The PHP FastCGI Process Manager.
[root@intelnuc log]# systemctl status mysqld -l
mysqld.service - MariaDB database server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled)
   Active: active (running) since lun. 2014-03-24 18:22:00 CET; 43min ago
  Process: 227 ExecStartPost=/usr/bin/mysqld-post (code=exited, status=0/SUCCESS)
 Main PID: 226 (mysqld)
   CGroup: /system.slice/mysqld.service
           └─226 /usr/bin/mysqld --pid-file=/run/mysqld/mysqld.pid

mars 24 18:21:58 intelnuc mysqld[226]: 140324 18:21:58 InnoDB: Completed initialization of buffer pool
mars 24 18:21:58 intelnuc mysqld[226]: 140324 18:21:58 InnoDB: highest supported file format is Barracuda.
mars 24 18:21:58 intelnuc mysqld[226]: 140324 18:21:58  InnoDB: Waiting for the background threads to start
mars 24 18:21:59 intelnuc mysqld[226]: 140324 18:21:59 Percona XtraDB (http://www.percona.com) 5.5.36-MariaDB-33.0 started; log sequence number 21527634
mars 24 18:21:59 intelnuc mysqld[226]: 140324 18:21:59 [Note] Plugin 'FEEDBACK' is disabled.
mars 24 18:21:59 intelnuc mysqld[226]: 140324 18:21:59 [Note] Server socket created on IP: '0.0.0.0'.
mars 24 18:21:59 intelnuc mysqld[226]: 140324 18:21:59 [Note] Event Scheduler: Loaded 0 events
mars 24 18:21:59 intelnuc mysqld[226]: 140324 18:21:59 [Note] /usr/bin/mysqld: ready for connections.
mars 24 18:21:59 intelnuc mysqld[226]: Version: '5.5.36-MariaDB-log'  socket: '/run/mysqld/mysqld.sock'  port: 3306  MariaDB Server
mars 24 18:22:00 intelnuc systemd[1]: Started MariaDB database server.

@MorrisJobke
Copy link
Contributor Author

TypeError: OC.generateUrl is not a function settings-user.js:70

and

Uncaught TypeError: undefined is not a function settings-user.js?v=da54dd5a0398011cdfa50d559c2c0ef8:70

Looks suspicious. I guess I missed the backport for stable6 and stable5 :( Will do that. Thanks

@MorrisJobke
Copy link
Contributor Author

@HLFH Fixed with 3f37653

@HLFH
Copy link

HLFH commented Mar 24, 2014

@MorrisJobke I have the same errors (TypeError: OC.generateUrl is not a function settings-user.js:70) but I'm on ownCloud 6.0.2 (http://download.owncloud.org/community/owncloud-6.0.2.tar.bz2) and I'm using Music in the last master branch so with the fixes 3f37653. I guess I have to be on ownCloud Master.

@MorrisJobke
Copy link
Contributor Author

I guess I have to be on ownCloud Master.

@HLFH No. I tested with stable5, stable6 and master branch and it works.

owncloud/core#7578 <- The backport was after the 6.0.2 release. So I will backport this inside of the music app. Thanks (I tested on git stable6 and there it is included)

@MorrisJobke
Copy link
Contributor Author

@HLFH d132b3d

@unomar
Copy link

unomar commented Mar 24, 2014

Awesome work @MorrisJobke! Tested streaming to Android via https using JustPlayer and Ampache Provider. Music streams without a hitch and is very light on server resources (important for me since I'm running archlinux-arm on a rooted pogoplug).

@MorrisJobke
Copy link
Contributor Author

@unomar Awesome to hear :) Did you have any problems with the user interface? (just asking to maybe improve it more and make it intuitive) Or is it just fine as it is now?

@unomar
Copy link

unomar commented Mar 24, 2014

The only issue I had was during upgrade from the old version. The DB threw an "Integrity Constraint Violation" on oc_music_ampache_users.description. I just manually deleted the ampache tables and it worked.

I think the interface is fine. Generating the API key is simple enough. With a little documentation I'm sure it would be easy for anyone.

@MorrisJobke
Copy link
Contributor Author

@unomar Yeah. I changed the Ampache tables a lot here in the development branch. But as this is just a development branch I think it's okay to have some manual steps.

Will write the documention. Thanks.

@unomar
Copy link

unomar commented Mar 24, 2014

@MorrisJobke Yeah, I figured it was just because I was using the bleeding edge.

Is there a way to trigger a music rescan when you change the music dir path? I tested using the provided music folder and later switched it to my main mp3 library, but it still only lists the single song. No offense to "Projekt Eva", but I'd prefer a few more songs. :P

@MorrisJobke
Copy link
Contributor Author

@unomar The music dir path doesn't affect the music scanner. The scanner always scans the whole ownCloud instance (will be changed later maybe). It just filters the collection method of the API which is used by the webinterface. So it will just filter all of your music for the webinterface in a way to improve the performance of this.

I know this is a quite odd behaviour.

@SunboX
Copy link

SunboX commented Apr 19, 2014

Is it true, that I still can't play/stream music over ampache? After some weeks, I updated today and tried it with "Lullaby 4 Ampache" on Android. I can see all songs, but if I try to play I do get a message saying "TODO"?

@MorrisJobke
Copy link
Contributor Author

@SunboX I guess you use 0.1.9.1-rc , right? I will try this client - is this the one you mentioned: https://play.google.com/store/apps/details?id=net.sileht.lullaby

It seems, that the client doesn't use the provided URLs

@SunboX
Copy link

SunboX commented Apr 20, 2014

No, I used the master branch. I will try tag 0.1.9.1-rc :)
I used this app: https://play.google.com/store/apps/details?id=com.blackspruce.lullaby
(the other one isn't compatible with newer android)

@SunboX
Copy link

SunboX commented Apr 20, 2014

Same with 0.1.9.1-rc

I can list all tracks, but if I try to play something I always getting the messages: "connected" ... "disconnected" ... "connected" ... "disconnected" ... and so on

@Fly0s
Copy link

Fly0s commented May 7, 2014

Using my login and a generated password for the ampache API, I can't use the Ampache Resolver in Tomahawk. The log says :
"Failed to do GET request: to: https://my.server.net/owncloud/index.php/apps/music/ampache/server/xml.server.php?timestamp=1399496300&version=350001&user=XXX&action=handshake&auth=0e1cad6824fb90bf84278a08a0dff5103e499196f41526424cd2a3d017901bfb&"
"Status Code was: 0"
(I blurred out the login and changed the server name...)

Any idea why ?

@Fly0s
Copy link

Fly0s commented Aug 9, 2014

Still having the same behaviour with Owncloud 7.0.1 and Music app 0.3. Amarok is apparently able to connect and detect the number of songs, but not to display the songs (or play any, for that matter).

I don't know why this is happening although this config is supposed to work with Tomahawk...

@MorrisJobke
Copy link
Contributor Author

The issue of @Fly0s Is tracked in #265

@MorrisJobke MorrisJobke removed their assignment Oct 5, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet