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

Does the labels of transmission support variable assignment? #3808

Closed
terrellgf opened this issue Jul 30, 2023 · 9 comments
Closed

Does the labels of transmission support variable assignment? #3808

terrellgf opened this issue Jul 30, 2023 · 9 comments
Labels

Comments

@terrellgf
Copy link

terrellgf commented Jul 30, 2023

I tried the following configurations, all failed:

transmission:
  labels: 
    - "{{title}}"

transmission:
  labels: 
    - '{{title}}'

transmission:
  labels: 
    - "{title}"

transmission:
  labels: 
    - '{title}'

It doesn't work......
Please help me, thx!

@crawln45
Copy link
Contributor

It's been a while since I looked at it. But I'm almost 100% sure we didn't implement jinja rendering for labels. Id have to look at it again. That being said I don't believe that's implemented at the moment.

@terrellgf
Copy link
Author

terrellgf commented Jul 30, 2023

It's been a while since I looked at it. But I'm almost 100% sure we didn't implement jinja rendering for labels. Id have to look at it again. That being said I don't believe that's implemented at the moment.

Thanks for your reply.
I need to use this function to get my file storage location, and use a system-level script to verify movie ratings to imdb website every day. Delete a movie if it doesn't meet the expected rating within 7 days of downloading it. To avoid the problem that happened earlier when a movie rated 7.3 had 108 votes, but two days later it had 540 votes and only got a 5.8 rating. I don't want to fix this by raising the limit vote count because I don't want to miss out on every potential new movie.
Initially I also tried to implement this functionality with flexget's plugin. I guess the imdb plugin does not have the function to force bypass the cache content, which makes it impossible for me to get the real-time score of imdb.

@crawln45
Copy link
Contributor

Caching I believe is set to 4 hrs. I could be wrong but that sounds about right. So as long as your checking the next day, your pulling fresh information. Implementing this would be similar in fashion to any of the other jinja rendering where we check and call the render function. You can look at many other plugins to check how it's implemented.

@terrellgf
Copy link
Author

Caching I believe is set to 4 hrs. I could be wrong but that sounds about right. So as long as your checking the next day, your pulling fresh information. Implementing this would be similar in fashion to any of the other jinja rendering where we check and call the render function. You can look at many other plugins to check how it's implemented.

The movie was downloaded on the 29th, but the rating is still 7.3 on the 30th (5.8 on the imdb website), and it has been more than 24 hours. I implemented this function with the filesystem/age/imdb_lookup/imdb/delete plugin.

@terrellgf
Copy link
Author

terrellgf commented Jul 31, 2023

def expired(self):
    """
    :return: True if movie details are considered to be expired, ie. need of update
    """
    if self.updated is None:
        logger.debug('updated is None: {}', self)
        return True
    refresh_interval = 2
    if self.year:
        # Make sure age is not negative
        age = max((datetime.now().year - self.year), 0)
        refresh_interval += age * 5
        logger.debug('movie `{}` age {} expires in {} days', self.title, age, refresh_interval)
    return self.updated < datetime.now() - timedelta(days=refresh_interval)

def __repr__(self):
    return f'<Movie(name={self.title},votes={self.votes},year={self.year})>'

The movie whose rating dropped from 7.3 to 5.8 was released in 2023. From the above code, we can see that the cache expiration time is 2 + (2023 - 2023) * 5, which means it takes two days to update the cache.
Is there anything else?

@gazpachoking gazpachoking changed the title Does the tabels of transmission support variable assignment? Does the labels of transmission support variable assignment? Aug 12, 2023
@gazpachoking
Copy link
Member

The movie whose rating dropped from 7.3 to 5.8 was released in 2023. From the above code, we can see that the cache expiration time is 2 + (2023 - 2023) * 5, which means it takes two days to update the cache.
Is there anything else?

That looks right. The ratings updates are the exact reason the cache is shorter for newer movies. Is this not working for you, or you want the cache to be shorter?

I'm not exactly sure how your initial request for templating support in the labels would help? What were you going to store in the labels?

@terrellgf
Copy link
Author

The movie whose rating dropped from 7.3 to 5.8 was released in 2023. From the above code, we can see that the cache expiration time is 2 + (2023 - 2023) * 5, which means it takes two days to update the cache.
Is there anything else?

That looks right. The ratings updates are the exact reason the cache is shorter for newer movies. Is this not working for you, or you want the cache to be shorter?

I'm not exactly sure how your initial request for templating support in the labels would help? What were you going to store in the labels?

I've solved my current problem using this update function logic, so this problem becomes less urgent for me. But I still hope to support assigning variable values ​​to transmission labels in the future.

Copy link

This issue is stale because it has been open 150 days with no activity. Remove stale label or comment or this will be closed in 30 days.

@github-actions github-actions bot added the Stale label Jan 10, 2024
@gazpachoking
Copy link
Member

This was added in #3886

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants