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

Remove all images for a show, using the ImageClass(). #3503

Merged
merged 20 commits into from
Dec 26, 2017

Conversation

p0psicles
Copy link
Contributor

  • PR is based on the DEVELOP branch
  • Don't send big changes all at once. Split up big PRs into multiple smaller PRs that are easier to manage and review
  • Read the contribution guide

@@ -1793,6 +1793,7 @@ def updateShow(self, show=None):

# force the update
try:
show_obj.remove_images()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

See one line change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Point is, that this is an object oriented approach. As the logic to delete the files in now in the ImageClass, where it should be. To make it more clean, we could even replace some of logic for cleaning up the images after a show delete, using this method.

@fernandog
Copy link
Contributor

fernandog commented Dec 20, 2017

Ok but as I said it won't work if user only one want to update images and not rescan ALL files.

My other PR has an action in mass update that only update images and doesn't rescan all files from disk

@codecov-io
Copy link

codecov-io commented Dec 20, 2017

Codecov Report

Merging #3503 into develop will decrease coverage by 0.09%.
The diff coverage is 17.64%.

Impacted file tree graph

@@            Coverage Diff             @@
##           develop    #3503     +/-   ##
==========================================
- Coverage    32.98%   32.88%   -0.1%     
==========================================
  Files          275      275             
  Lines        34826    35078    +252     
==========================================
+ Hits         11486    11536     +50     
- Misses       23340    23542    +202
Impacted Files Coverage Δ
medusa/server/web/home/handler.py 12.1% <0%> (-0.01%) ⬇️
medusa/server/web/manage/handler.py 7.72% <11.11%> (+0.08%) ⬆️
medusa/image_cache.py 18.03% <18.18%> (+0.02%) ⬆️
medusa/tv/series.py 29.01% <50%> (+0.03%) ⬆️
medusa/clients/torrent/deluge_client.py 14.28% <0%> (-0.41%) ⬇️
medusa/clients/torrent/transmission_client.py 17.46% <0%> (-0.15%) ⬇️
medusa/post_processor.py 60.69% <0%> (-0.14%) ⬇️
medusa/logger/adapters/style.py 77.61% <0%> (+3.53%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 62dadf5...f36c9b9. Read the comment docs.

@p0psicles
Copy link
Contributor Author

What's wrong with rescanning? I thought that was the solution, we agreed on? Just do a force full update right?
And if you want to add the massUpdate part. No prob. just use the ImageClass the remove and repopulate the images.

@fernandog
Copy link
Contributor

@p0psicles sure but I also want to add an option to only update images. Rescanning a 10 season show with tons of episodes may be wrong if user want only new images. Understood my pov?

@p0psicles
Copy link
Contributor Author

You can use the Image Class for that. Fine if you add it in this Pr.

@fernandog
Copy link
Contributor

@p0psicles ok but I still don't know how to NOT lock the ui when calling a unscheduled task

@labrys
Copy link
Contributor

labrys commented Dec 21, 2017

Accidentally pushed to wrong branch. Reverted after.

@p0psicles
Copy link
Contributor Author

@fernandog just port your changes for the massEdit to this pr.
And the massEdit is a fast action. It's not needed to run in a thread. Threads are used for heavy duty.

Only difference now, compared to your pr. Is that you have to use the command from this PR to remove the images. And after that, you recreate them.

@fernandog
Copy link
Contributor

@p0psicles I cherry-picked and changed code BUT its reading ALL files from disk.

I did for only one show with 100 episodes and I got 100 logs like this:
Setter sets location to

as you can see in the code:

    @location.setter
    def location(self, value):
        log.debug('{id}: Setter sets location to {location}',
                  {'id': self.series.indexerid, 'location': value})
        self._location = value
        self.file_size = os.path.getsize(value) if value and self.is_location_valid(value) else 0

If calls os.path to get size of all files and check if file exists.
It does all that just to update images.
I don't agree with this actions

@p0psicles
Copy link
Contributor Author

I tested this (also the massupdate) and besides one small error, ALl LGTM.

@fernandog
Copy link
Contributor

@p0psicles did you read my message about it reading all files from disk when doing this image update?

@p0psicles
Copy link
Contributor Author

Yeah commented on it on slack. But I can't reproduce it. But I didn't have any episodes in my shows. So maybe that's why?

@p0psicles p0psicles merged commit ecd90eb into develop Dec 26, 2017
@p0psicles p0psicles deleted the feature/remove-images-force-update branch December 26, 2017 10:54
@p0psicles p0psicles added this to the 0.1.21 milestone Dec 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants