Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

query filecache for media files, overwrite path with path from filecache #182

Merged
merged 2 commits into from Apr 25, 2014

Conversation

butonic
Copy link
Member

@butonic butonic commented Mar 25, 2014

@MorrisJobke @DeepDiver1975 Here is something to work with. This PR uses the filecache to search for audio files and overwrites the path of the track entities with the one from the filecache. A similar hack would be needed for cover art, but I wanted to get this out ASAP for discussion.

Personally, I think this is an ugly solution ... then again the sharing implementation has its deficiencies. The whole reason we have to go this route is because sharing allows sharing a folder with a single share entry, not marking all affected files as shared ... hm ... need to chew on that ...

@butonic
Copy link
Member Author

butonic commented Mar 25, 2014

@MorrisJobke I need some help with mocking searchByMime(). I toyed around with it locally, but don't seem to get how to use mocking :(

@butonic
Copy link
Member Author

butonic commented Mar 25, 2014

Added a hack for the cover file path as well. works fine here ... still need help with mocking searchByMime() to make travis happy.

@butonic
Copy link
Member Author

butonic commented Mar 25, 2014

@MorrisJobke now also removes tracks when unsharing them. Boy this is just getting uglier and uglier ...

@butonic
Copy link
Member Author

butonic commented Apr 1, 2014

@MorrisJobke This PR now uses the getPath implementation from owncloud/core#7935 to resolve the paths for tracks and covers.

The covers however will only show up after the user has updated the filecache (via cron or ajaxcron etc) @icewind1991 please review.

@@ -199,14 +199,23 @@ public function update($path, $userId = NULL){
* Get called by 'delete' hook (file deletion)
* @param string $path the path of the file
*/
public function delete($path){
public function deleteByPath($path){
$metadata = $this->api->getFileInfo($path);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add here the emit of the "delete" event?

$this->emit('\OCA\Music\Utility\Scanner', 'delete', array($fileId, $userId));

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

feel free to change the PR to your needs

@MorrisJobke
Copy link
Contributor

Once the stuff is merged into master this will be merged.

@butonic @DeepDiver1975 @icewind1991 Any ideas for OC6 and OC5?

@MorrisJobke
Copy link
Contributor

I squashed all the commits into one and force pushed to remove the ugly workaround code from git :)

butonic and others added 2 commits April 25, 2014 14:32
* add hook handler for unshare event - deletes track on unshare
* use of methods instead of key access for metadata
@scrutinizer-notifier
Copy link

The inspection completed: 7 updated code elements

MorrisJobke added a commit that referenced this pull request Apr 25, 2014
query filecache for media files, overwrite path with path from filecache
@MorrisJobke MorrisJobke merged commit 47de870 into master Apr 25, 2014
@MorrisJobke MorrisJobke deleted the access_shared_files branch April 25, 2014 13:29
@mmattel mmattel mentioned this pull request Apr 25, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants