jerrellmardis / Amphitheatre

Amphitheatre is an Android TV app that connects with network shares, organizes and serves videos to any Android capable media player app.
Apache License 2.0
437 stars 87 forks source link

Fails To Update Library When Samba Shared Folder Has Only One Of The Supported Files In It. #20

Closed eyedol closed 10 years ago

eyedol commented 10 years ago

If you have one movie( one of the supported files ) in your samba shared folder, app fails to update the library when you add a source.

To produce this, add a source with a shared folder that has only one supported file in it. See a toast message show up saying it failed to update the library. I have attached the Exception thrown as well and a sample directory structure

Public
`-- Eat
    `-- Eat\ Pray\ Love.mkv

Exception:

08-08 09:11:03.475: W/System.err(3001): java.lang.IllegalArgumentException: Size must be greater than 0
08-08 09:11:03.475: W/System.err(3001):     at org.apache.commons.collections4.ListUtils.partition(ListUtils.java:659)
08-08 09:11:03.475: W/System.err(3001):     at com.jerrellmardis.amphitheatre.task.GetFilesTask.onPostExecute(GetFilesTask.java:77)
08-08 09:11:03.475: W/System.err(3001):     at com.jerrellmardis.amphitheatre.task.GetFilesTask.onPostExecute(GetFilesTask.java:37)
08-08 09:11:03.475: W/System.err(3001):     at android.os.AsyncTask.finish(AsyncTask.java:632)
08-08 09:11:03.475: W/System.err(3001):     at android.os.AsyncTask.access$600(AsyncTask.java:177)
08-08 09:11:03.475: W/System.err(3001):     at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:645)
08-08 09:11:03.475: W/System.err(3001):     at android.os.Handler.dispatchMessage(Handler.java:102)
08-08 09:11:03.475: W/System.err(3001):     at android.os.Looper.loop(Looper.java:135)
08-08 09:11:03.475: W/System.err(3001):     at android.app.ActivityThread.main(ActivityThread.java:5070)
08-08 09:11:03.475: W/System.err(3001):     at java.lang.reflect.Method.invoke(Native Method)
08-08 09:11:03.476: W/System.err(3001):     at java.lang.reflect.Method.invoke(Method.java:372)
08-08 09:11:03.476: W/System.err(3001):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:836)
08-08 09:11:03.476: W/System.err(3001):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:631)

When files.size() is 1 this files.size() / maxPoolSize; calculation returns 0 and it seems ListUtils.partition expects a value greater than 0 for the partitionSize

jerrellmardis commented 10 years ago

Ok, thanks. I'll take a look.