Closed blmatthews closed 2 years ago
That was a little messy. I separated the date from the album ID and pass them as two separate parameters now like you suggested. Now everything should have congruent nomenclature.
Looks good! Yeah, a little messy, but not too bad. I downloaded everything and it worked fine, everything has dates in the names now. Of course, again, I only subscribe to one profile, although it has everything except stories, so it's not an extensive test, but not bad either. Thanks!
When downloading photos and videos in messages, if there are multiple photos or videos in a message and-\/\-\.\, and videos to messages/videos/..., as expected. However, if a message only contains a single photo (or video), it's written to messages/photos/\.\, with no date (and similar for videos except under messages/videos). Posted photos and videos, on the other hand, always have the date in the filename, regardless of whether they're in a subdirectory or not. It would be nice if photos and videos in messages were named the same way as in posts.
ALBUMS
isTrue
, photos are written to messages/photos/\Looking at the code, the base problem is that the data structures for post media and message media are different (of course they are! sighs and shakes head), so
download_media
can usemedia['createdAt']
for post media but not message media. For that it gets the date fromalbum
, but that only works ifalbum
isn'tFalse
(i.e.ALBUMS
isTrue
and there's more than one media in the message.) If it is, it just uses the id.While I haven't tried this, I think the most straightforward fix might be to have
download_media
take the date as a parameter. Then it can always add the date to the filename, and doesn't have to assume the contents ofalbum
. The only function callingdownload_media
isget_content
, and it's already doing some stuff to get the date for the album, so it would seem logical to have something in thefor
loop starting at line 205 to get the date for the media. Or maybe not, I've only looked at it a bit.Note that I think the same issue happens with purchased media, although my only purchase included two things. However, they're handled the same as messages, so fixing the issue for messages should fix it for purchases as well.