Sonerezh / sonerezh

A self-hosted, web-based application to stream your music, everywhere.
https://www.sonerezh.bzh
GNU Affero General Public License v3.0
766 stars 122 forks source link

Statistics shows incorrect values? #308

Closed pacija closed 7 years ago

pacija commented 7 years ago

Hi,

it appears that statistics on settings page shows incorrect values.

My music collection currently has 7683 files, as shown by find:

pacija@apache1:~ % find /home/pacija/music -type f | wc -l
    7683

Clementine-player shows the same value. Sonerezh import page shows the same value before import. Number of rows in songs table after import is also 7683.

However, statistics page shows 7662 songs.

Any idea what causes this?

gs11 commented 7 years ago

The query for songs number had an erroneous grouping. Fixed in PR #309

pacija commented 7 years ago

Thanx @gs11, application of your patch resulted in correct Songs number.

Albums still show one album too many, when compared with exporting 'album' column from mysql to text and counting unique lines only (cat albums.txt | uniq | wc -l).

Not too much of a problem, but still, if you had an idea on how to solve it I'd be thankful.

OT: I see you are most active with development. I wanted to switch to your fork, but it doesn't work for me. Would you like to have PRs reported for your fork?

MightyCreak commented 7 years ago

What doesn't work for you? I switched to @gs11's branch and it works pretty fine here.

gs11 commented 7 years ago

@pacija The developer(s) informed me that they're taking a temporary pause so please submit PRs to this repository.

Regarding the number of albums, what SQL query did you use?

MightyCreak commented 7 years ago

BTW @gs11, I can't create an issue on your fork, is it intentional?

gs11 commented 7 years ago

@MightyCreak Issues were turned off by default but activated them now.

pacija commented 7 years ago

@MightyCreak I'll submit issue in @gs11's fork. With FreeBSD's mysql57-server-5.7.18's default my.cnf, click on /albums throws:

2017-05-23 16:10:47 Error: [PDOException] SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #4 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'underbottom_sonerezh.Song.cover' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
Request URL: /albums
Stack Trace:
#0 /usr/local/www/sonerezh-development-new/lib/Cake/Model/Datasource/DboSource.php(470): PDOStatement->execute(Array)
#1 /usr/local/www/sonerezh-development-new/lib/Cake/Model/Datasource/DboSource.php(436): DboSource->_execute('SELECT MIN(`Son...', Array)
#2 /usr/local/www/sonerezh-development-new/lib/Cake/Model/Datasource/DboSource.php(673): DboSource->execute('SELECT MIN(`Son...', Array, Array)
#3 /usr/local/www/sonerezh-development-new/lib/Cake/Model/Datasource/DboSource.php(1184): DboSource->fetchAll('SELECT MIN(`Son...', Array)
#4 /usr/local/www/sonerezh-development-new/lib/Cake/Model/Model.php(3038): DboSource->read(Object(Song), Array)
#5 /usr/local/www/sonerezh-development-new/lib/Cake/Model/Model.php(3010): Model->_readDataSource('all', Array)
#6 /usr/local/www/sonerezh-development-new/app/Controller/SongsController.php(314): Model->find('all', Array)
#7 [internal function]: SongsController->albums()
#8 /usr/local/www/sonerezh-development-new/lib/Cake/Controller/Controller.php(491): ReflectionMethod->invokeArgs(Object(SongsController), Array)
#9 /usr/local/www/sonerezh-development-new/lib/Cake/Routing/Dispatcher.php(193): Controller->invokeAction(Object(CakeRequest))
#10 /usr/local/www/sonerezh-development-new/lib/Cake/Routing/Dispatcher.php(167): Dispatcher->_invoke(Object(SongsController), Object(CakeRequest))
#11 /usr/local/www/sonerezh-development-new/app/webroot/index.php(107): Dispatcher->dispatch(Object(CakeRequest), Object(CakeResponse))
#12 {main}
gs11 commented 7 years ago

Please close the issue @pacija if it works fine for you now.

pacija commented 7 years ago

Closing. Album count is also OK, I found out I had two albums with the same name, which sonerezh correctly counted as two different albums, while my methods of checking didn't (SELECT DISTINCT album FROM songs ).

Thank you for making sonerezh better!