After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 539804 - Directories aren't created on MTP device
Directories aren't created on MTP device
Status: RESOLVED WONTFIX
Product: banshee
Classification: Other
Component: Device - MTP
git master
Other Linux
: Normal enhancement
: ---
Assigned To: Banshee Maintainers
Patrick van Staveren
gnome[unmaintained]
Depends on: 724678
Blocks: 723695
 
 
Reported: 2008-06-23 18:50 UTC by Mieszko Ślusarczyk
Modified: 2020-03-17 08:24 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to add nested folder support for MTP storing and retrieval (5.96 KB, patch)
2012-11-18 21:01 UTC, IBBoard
none Details | Review
Properly formatted patch for nested folder support on MTP (7.65 KB, patch)
2013-01-05 14:23 UTC, IBBoard
rejected Details | Review
Adds folder heirarchy support to Mtp track detection (6.77 KB, patch)
2014-02-08 17:35 UTC, Nicholas Little
committed Details | Review
Write support (3.65 KB, patch)
2014-02-08 19:11 UTC, Nicholas Little
none Details | Review
Caching Test Run (3.15 KB, text/plain)
2014-02-09 17:32 UTC, Nicholas Little
  Details
Adds caching and compresses for loops with a Predicate (5.37 KB, patch)
2014-02-09 17:37 UTC, Nicholas Little
none Details | Review

Description Mieszko Ślusarczyk 2008-06-23 18:50:31 UTC
When copying music to my ZEN Vision:M, the directory structure isn't preserved, instead the files are copied to "Music" folder. This is a big problem, because, when you have a 30GB device, filled with music it takes ages, to browse it , when you have ~4000 songs in ONE directory. Besides, it is really hars to organize anything in such way, and I wonder what happens if i want to transfer two songs with same filename or tracknumber/title...
Comment 1 Gabriel Burt 2009-04-30 00:33:54 UTC
Does your device actually let you browse it by folder?  I have vision W and a zen vplus, and afaict neither let you do that - they automatically generate lists of genres/albums/artists.  That's why I didn't worry about putting tracks in folders other than the Music folder.
Comment 2 Kevin Duffus 2009-04-30 01:05:09 UTC
The Creative Zen players do not allow you to browse by folder from the device itself. I believe the Mieszko is referring to mounting the device for viewing using gphoto tools or in Windows explorer without Banshee. If you're only using Banshee to manage the device, then it the internal folder structure shouldn't matter to the end user.
Comment 3 Mieszko Ślusarczyk 2009-04-30 04:46:10 UTC
Yes, and also when mounting it with mtpfs. It matters, because it severly slows down browsing, when I have 4000 tracks in one folder. I also want to be able to easy manage music "by hand" when necessary.
Comment 4 farfouille64 2009-06-25 11:43:31 UTC
I have the same issue with both Creative Zen Vision: M and Creative Zen Touch.

By the way, I don't think it is just a matter of internal structure because :
1/ as already said it takes ages to browse and update
2/ file names are wrong ; there are composed only of track number + track title which can lead to crushing of files
Comment 5 Gabriel Burt 2009-10-27 20:18:29 UTC
Bulk changing the assignee to banshee-maint@gnome.bugs to make it easier for people to get updated on all banshee bugs by following that address.  It's usually quite apparent who is working on a given bug by the comments and/or patches attached.
Comment 6 Sebastian Krämer 2010-09-21 16:13:23 UTC
My MTP also allows browsing per directory (and actually, since display and buttons are small, it's my preferred way of browsing the songs; everything else takes ages). And yes, being able to manage files in a file browser is a plus, too.
Comment 7 IBBoard 2012-11-18 21:01:48 UTC
Created attachment 229307 [details] [review]
Patch to add nested folder support for MTP storing and retrieval

I've had problems with tracks synced from other players being counted as "Otehr" and not showing up in the track list. It appears to be because Banshee quite literally says "file is in Music folder" to count it as a music file. The attached patch may not be the cleanest, but it works for me to get nested folder support so that a) Banshee stores files in nested folders on the device (/Music/artist/album/track.ext) and b) Banshee loads *all* music files from anywhere under /Music/.

The patch could possibly be a bit more efficient as well, but the existing code doesn't seem to cache many objects, so I've avoided caching and keeping parent/child objects as well, even if it takes a slight performance hit.

If anyone is using openSUSE 12.x then the patch (along with a patch to handle changes in libmtp) will be built into my version of the latest packages in the OBS: https://build.opensuse.org/package/show?package=banshee&project=home%3AIBBoard%3Adesktop
Comment 8 IBBoard 2013-01-05 14:23:56 UTC
Created attachment 232825 [details] [review]
Properly formatted patch for nested folder support on MTP
Comment 9 Nicholas Little 2014-02-05 18:23:05 UTC
Hi, I'll give your patch a try, probably over the weekend. We shall worry about efficiency later ;)

Just a quick thought, when loading from the device, did you consider evaluating files based on their type as a possible solution?
Comment 10 IBBoard 2014-02-05 18:51:01 UTC
I kept the loading logic as close to the original as possible for ease of implementation. I've not got anything against dedicated "Music" folders, so I just worked on organising it below that level. It could probably be done based on type, though.
Comment 11 Nicholas Little 2014-02-08 17:35:26 UTC
Created attachment 268512 [details] [review]
Adds folder heirarchy support to Mtp track detection

Hi, nice work!

I was asked to try and separate the patch into read and write support by one of the banshee developers to try and make it easier to back port for older versions. 

I briefly tested the write support which worked well, but I've concentrated on the read side to start with. I did a little massaging:

- Changed InFolderOrSubfolder to an overload of InFolder accepting a recursion boolean, which is then called from InFolder. Just prevents the InFolder condition being in there twice.

- I removed the MtpDevice argument from the Track.InFolderOrSubfolder as we (should!) have the device reference in a member variable already. As you probably did, I noticed that can be null so I modified the Track constructor to at least always expect one. It might be worth throwing in the constructor if the user passes a null reference but I didn't go that far.

- In Folder.Find(MtpDevice, uint) I thought it makes more sense to throw if the user passes a null MtpDevice reference instead of returning false. Also, I couldn't see any uses of the null object pattern in close proximity so decided it makes more sense to return null in the case where we don't find the folder. Last, I wrapped the section after getting the folder list in a try/finally so that we can ensure the unmanaged folder is cleaned up after we're done.

- To add some protection I did a little error checking in HasAncestor, making sure the folder's not null and throwing if so, in addition to making sure we're not trying to compare two folders from different devices.

Ok with you?

Thanks.
Comment 12 Nicholas Little 2014-02-08 19:11:20 UTC
Created attachment 268518 [details] [review]
Write support

I separated the write support into this patch, and gave it a slight massage in line with what we see in MassStorageSource.cs.

I took the liberty of adding similar support for Podcasts, even if a device happens to have a null PodcastFolder member, as in my Samsung S2.

This ok?
Comment 13 Andrés G. Aragoneses (IRC: knocte) 2014-02-08 19:15:27 UTC
Nice work Nicholas!

As IBBoard was the first to implement this patch, I hope you don't mind that when I review and commit these patches, I'll mark one of them with IBBoard as the author.

(In reply to comment #12)
> I took the liberty of adding similar support for Podcasts, even if a device
> happens to have a null PodcastFolder member, as in my Samsung S2.

Shouldn't this logic maybe be part of the Podcast extension? Just wondering.
Comment 14 IBBoard 2014-02-08 19:17:08 UTC
My code was a quick hack that worked well enough for me. I was aware there was some error handling and conditions that I probably wasn't handling, but I didn't know MTP enough to cover it all. I thought there might be some optimisations as well, but I wasn't sure how much the native references would change, so I didn't know how safe it was and went for "too much processing is better than crashes through optimisation". I don't mind if Nicholas is the author and I just get a "based on initial patch from IBBoard" note in the commit (if you guys do that).
Comment 15 Andrés G. Aragoneses (IRC: knocte) 2014-02-08 19:24:50 UTC
SGTM :)

I'll review the patches soon (probably mid-next-week).
Comment 16 Nicholas Little 2014-02-08 19:26:49 UTC
knocte: Of course I don't mind. It was really nice to find one thing on the
list
already done!

I haven't looked at the Podcast extension, but the MassStorageSource seems to
generate its own paths. I'll make a note to take a look and see what's in there
:)

I did have a look at categorizing files by type when reading, but this approach
is pretty quick and won't miss much. Also, the file type recognition in the
Mtp.Track class is a little primitive for the moment so a standard way of doing
this over a file's uri would be handy, although I don't think it exists yet.

IBBoard: I barely touched your patch apart from splitting it and adding a bit
of error checking. Most of my time was spent trying to get my copy of
monodevelop to write spaces instead of tabs. ;)
Comment 17 Nicholas Little 2014-02-09 17:32:58 UTC
Created attachment 268592 [details]
Caching Test Run

I decided to do a little more testing and look deeper at the MtpSource.

Noticing that we have a Dictionary<string, Mtp.Album> I decided to expand on that a little by turning it into a Dictionary<string, Tuple<Mtp.Folder, Mtp.Album>> with the patch attached to the next post.

The results are presented in the text file I attach here, I've worked out some simple statistics in the "Summary" section from which it looks like caching saves us some time, at least in this fairly contrived example ;)
Comment 18 Nicholas Little 2014-02-09 17:37:07 UTC
Created attachment 268594 [details] [review]
Adds caching and compresses for loops with a Predicate

I couldn't obsolete the Write support patch and "git format-patch HEAD~3" just gives me three patch files, number 2 was just to pull the latest Hyena, hence the 0003 in this patch number. If applied straight after "Write support" then it should work correctly ;)
Comment 19 Andrés G. Aragoneses (IRC: knocte) 2014-02-18 18:33:59 UTC
Comment on attachment 268512 [details] [review]
Adds folder heirarchy support to Mtp track detection

I committed this to master and stable branch. Thanks guys!
Comment 20 Andrés G. Aragoneses (IRC: knocte) 2014-02-18 18:35:12 UTC
Comment on attachment 232825 [details] [review]
Properly formatted patch for nested folder support on MTP

Marking this one as obsolete, since Nicholas has split it in two.
Comment 21 Nicholas Little 2014-02-28 18:15:57 UTC
*** Bug 722991 has been marked as a duplicate of this bug. ***
Comment 22 Andrés G. Aragoneses (IRC: knocte) 2014-03-26 18:32:18 UTC
Thanks to Nicholas' work on splitting the patches, FYI his patch was committed as solving bug 724678, which is a subset of what this bug was about.

Now that only the write-part of this bug is meant to be discussed here, I think we can all agree that this is an enhancement, so I'm marking it as such.
Comment 23 Mieszko Ślusarczyk 2014-03-26 23:27:34 UTC
Hi,

I'vereported this issue nearly 6 years ago, now I am neither using banshee, nor my ZEN Vision:M.
I can not remove myself from CC list (probably because I'm reporter of this bug).

Can someone please make bugzilla not e-mail me about this bug anymore?

Cheers,
Mieszko
Comment 24 Andrés G. Aragoneses (IRC: knocte) 2014-03-26 23:38:58 UTC
(In reply to comment #23)
> I'vereported this issue nearly 6 years ago, now I am neither using banshee, nor
> my ZEN Vision:M.
> I can not remove myself from CC list (probably because I'm reporter of this
> bug).
> 
> Can someone please make bugzilla not e-mail me about this bug anymore?

I don't think that's possible (unless maybe you contact the sysadmin team, they're usually active in IRC). I recommend creating a bug in bugzilla's bugilla (bugzilla.mozilla.org) also to request this feature request :)

In the meantime, the easiest solution could be to just create an email filter in your end, or unsubscribe altogether from all bugzilla's email if you don't use any of gnome either.

Thanks
Comment 25 André Klapper 2020-03-17 08:24:44 UTC
Banshee is not under active development anymore and had its last code changes more than three years ago. Its codebase has been archived.

Closing this report as WONTFIX as part of Bugzilla Housekeeping to reflect
reality. Please feel free to reopen this ticket (or rather transfer the project
to GNOME Gitlab, as GNOME Bugzilla is being shut down) if anyone takes the
responsibility for active development again.
See https://gitlab.gnome.org/Infrastructure/Infrastructure/issues/264 for more info.