CDrummond / cantata

Qt5 Graphical MPD Client
GNU General Public License v3.0
1.04k stars 184 forks source link

crash trying to copy tracks to attached android device #1731

Closed molecular closed 3 years ago

molecular commented 3 years ago

NOTE Cantata is now in a bug-fix only state. Only bugs that are actual bugs, and not missing functionality will be fixed. Pull requests, however, will still be accepted.


Describe the bug Using a dynamically generated playlist I'm trying to copy files to an attached android phone. When selecting the tracks, then right-clicking on "Copy Songs to Device", then selecting my device, I get error popup saying the device has 0 bytes storage available and the files need to be converted.

image

I configure the device setting to recode to mp3.

image

And click OK here:

image

When the first file is being processed, after about 5 seconds cantata crashed with following output:

~$ Unfortunately Cantata has crashed. Please report a bug at                            ~
https://github.com/CDrummond/cantata/issues/ and include the following stack trace:

  /usr/lib/libc.so.6 : ()+0x3cda0
  cantata : QtPrivate::RefCount::ref()+0
  cantata : MtpConnection::putSong(Song const&, bool, DeviceOptions const&, bool, bool)+0xcb
  /usr/lib/libQt5Core.so.5 : QObject::event(QEvent*)+0x2af
  /usr/lib/libQt5Widgets.so.5 : QApplicationPrivate::notify_helper(QObject*, QEvent*)+0x82
  /usr/lib/libQt5Core.so.5 : QCoreApplication::notifyInternal2(QObject*, QEvent*)+0x13a
  /usr/lib/libQt5Core.so.5 : QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*)+0x189
  /usr/lib/libQt5Core.so.5 : ()+0x312604
  /usr/lib/libglib-2.0.so.0 : g_main_context_dispatch()+0x25c
  /usr/lib/libglib-2.0.so.0 : ()+0xa7b59
  /usr/lib/libglib-2.0.so.0 : g_main_context_iteration()+0x31
  /usr/lib/libQt5Core.so.5 : QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>)+0x66
  /usr/lib/libQt5Core.so.5 : QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>)+0x12c
  /usr/lib/libQt5Core.so.5 : QThread::exec()+0x62
  /usr/lib/libQt5Core.so.5 : ()+0xcdf7f

[1]  + exit 1     cantata

To Reproduce see above

Expected behavior Files copied to device

Screenshots see above

Version Info Cantata 2.4.2 on archlinux installed using pacman

CDrummond commented 3 years ago

This only seems to happen if Cantata is started before the device is connected. Looks like libMTP fails to get the list of storages on the device - hence the '0 bytes' Cantata fails to check for that, so crashes. This crash is now fixed.

Would be better if this connect case could be resolved, but I tried and failed. MTP is pretty awful though, so I have no time to investigate. Basically connect the device before starting Cantata. (I did try having cantata disconnect and then connect, but libMTP fails to disconnect!)

molecular commented 3 years ago

That workaround works.

Now I just have to find out where the files land on the phone. I never use mtp (usually copy stuff to phone using adb), so this is new for me.

Thanks for the workaround.

molecular commented 3 years ago

hm, ok, found where they're put: into Music folder, subfolder for Artist, then subfolder for Album.

Maybe you have an idea: I have a dynamic playlist and I want to copy the respective songs to my device, preferrably into one folder on the device so I can listen to that "playlist snapshot". The way "copy to device" places the files on the phone makes that impossible, it seems.

CDrummond commented 3 years ago

You could use; USB mass-storage access (e.g. treat phone like a usb stick), mount phone to somewhere on local file system and 'Add device' / 'Locally mounted folder', or install an ssh/sftp server on the phone and 'Add device' / 'Secure shell (sshfs)' All of these options allow you to specify destination folder and filename format - so can specify folder heirarchy.

Apart from that, sorry, Cantata was not designed to copy playlists. AFAIK, there is no standard location for these anyway.

molecular commented 3 years ago

ok, thanks a lot. These are good suggestions. Didn't know I could add a local folder as destination.