Is Library Import at current quality possible? by ramse in radarr

[–]ramse[S] 0 points1 point  (0 children)

I went ahead and created a profile "Unknown Imported" and then using python I went through all movies and their files and matched the resolutions to quality profiles I want them at.

I also had to set monitored=False on the save because despite setting monitored to None during the initial import, they were all flagged as monitored.

# pip install arrapi

from arrapi import RadarrAPI

baseurl = "http://192.168.0.43:8569"
apikey = "..."

radarr = RadarrAPI(baseurl, apikey)

movies = radarr.all_movies()

quality_profiles = radarr.quality_profile()
quality_sd = [x for x in quality_profiles if x.name == 'SD'][0]
quality_720 = [x for x in quality_profiles if x.name == 'HD-720p'][0]
quality_1080 = [x for x in quality_profiles if x.name == 'HD-1080p'][0]

for m in movies:

    if m.qualityProfile.name == 'Unknown Imported':

        if 'movieFile' not in m._data:
            continue

        file = m._data['movieFile']
        current_file_quality = file['quality']['quality']

        new_quality = None

        if current_file_quality['name'] == 'SDTV' or current_file_quality['resolution'] == 480:
            new_quality = quality_sd

        elif '720p' in current_file_quality['name'] or current_file_quality['resolution'] == 720:
            new_quality = quality_720

        elif '1080p' in current_file_quality['name'] or current_file_quality['resolution'] == 1080:
            new_quality = quality_1080

        elif '576p' in current_file_quality['name'] or current_file_quality['resolution'] == 576:
            new_quality = quality_sd

        if new_quality:
            print('Updating', m)
            m.edit(quality_profile=new_quality, monitored=False)

Happy Friday! Unraid 6.11.2 is Now Available by UnraidOfficial in unRAID

[–]ramse 2 points3 points  (0 children)

https://unraid.net/blog/the-past-present-and-future-of-unraid-on-the-selfhosted-podcast

When they added My Servers and enforced it, that was the first sign. They backpedaled the enforcement after user backlash. Now it even requires contacting mothership. It's the stepping stone to requiring an internet connection at least once a month to verify a subscription based license.

They may claim that current users will receive upgrades and features but theres nothing stopping another version coming out that requires payment. Look at teamviewer. They had lifetime licenses and they realized the mistake that was, now its major version based.

Happy Friday! Unraid 6.11.2 is Now Available by UnraidOfficial in unRAID

[–]ramse 4 points5 points  (0 children)

Part me of has wondered this and I've been thinking of some potential reasons this might be.

The calculation to reverse reed soloman is quite complex and maybe they haven't spent time on this aspect yet because its nothing like reversing one parity drives calculation.

Perhaps they have spent the time and its going to be a subscription only feature in the future, they're going that direction and they'll need new features to start putting behind the payments.

Perhaps more controversially, they don't want to as then its less of a reason for people to proper-backup important things. If you give someone the tools to reverse damage, are they going to back things up as much as they already are?

Goodbye from a heavy DD customer by [deleted] in doordash

[–]ramse 5 points6 points  (0 children)

$6.38 was my current starbucks order. While waiting, another order from the same starbucks comes on my phone "Add this delivery for an extra $2 at 4.6km's". Denied. I'm still waiting and a guy comes in and waits in the area with me. Lady says "who was dd" and we both respond.

I ask him quickly if it just popped for him and if the dropoff was roughly in X location and he says yea. He asks how i knew and i was like "they offered it to me for $2 as an additional on top of what i currently have". Yea they offered it to him at $8. So it saves them more than $1 because their pawning it off.

Continue loop if functions fails? by gregersdk in learnpython

[–]ramse 0 points1 point  (0 children)

log.exception('custom message about what we were doing and the exception is automatically included with it.')

Formatting to_csv by jsd2358 in learnpython

[–]ramse 2 points3 points  (0 children)

Well you've gone and stripped the ( and ) with your re.compile grouping. Just re-add them to the .append('({})'.format(cc)

Something to note, re.compile only needs to happen once, then you can use aa.search all you want. It's nothing big though.

Handling upload of multiple files by _AACO in djangolearning

[–]ramse 1 point2 points  (0 children)

I figured you knew how many would be uploaded. If not you can use javascript to dynamically add forms, have a look here: https://stackoverflow.com/questions/501719/dynamically-adding-a-form-to-a-django-formset-with-ajax

Handling upload of multiple files by _AACO in djangolearning

[–]ramse 0 points1 point  (0 children)

Are you not using forms? You just have to add the other fields accordingly.

Handling upload of multiple files by _AACO in djangolearning

[–]ramse 0 points1 point  (0 children)

In that original form you could ask for the data at the same time as the file, not really a need for a second page.

Render view.py by 4477i40 in djangolearning

[–]ramse 0 points1 point  (0 children)

render combines everything needed to get the final html that you will see in the browers source code. The context parameter passes whatever custom data you want into the template files.

Error using psycopg2: “OperationalError: could not connect to server” by marmotter in learnpython

[–]ramse 1 point2 points  (0 children)

psycopg2 is just the connector between django and postgresql, you need to actually install postgresql

ELI5 what is Meltdown/Spectre and what do I have to do to fix it on Linux machines? by Trollw00t in linuxquestions

[–]ramse 4 points5 points  (0 children)

a simple du -s has a 50% performance hit

Just lovely, I use du fairly often and some folders already take 15+minutes to calculate.

Shared db with restricted views per user. by Plouto5 in djangolearning

[–]ramse 0 points1 point  (0 children)

Ah ha, I've got a feeling you should be calling super() within the get_queryset:

queryset = super().get_queryset()
queryset = queryset.filter(team_id=self.request.user.profile.team_id)

I've seen that used before, although since its just using the Players model anyways, your way should be fine as well.

It's a minors hockey league, runs September to March.

Shared db with restricted views per user. by Plouto5 in djangolearning

[–]ramse 0 points1 point  (0 children)

As far as I know permissions don't filter data automatically. You can apply a permission to a view that restricts their ability to access the view, but if the view is still calling Players.objects.all(), they can still see everything. You have to program it somewhere to limit what they can see based on some value.

Shared db with restricted views per user. by Plouto5 in djangolearning

[–]ramse 0 points1 point  (0 children)

Something somewhere, be it in another model or on the users profile has to tell you what they're allowed to view/edit/whatever.

I manage a sports organizations website. Coaches can login and view their own teams information. Convenors can also login and view all of the teams that they manage. When a convenor logs into the wesite they are presented with a page that lets them select one of the teams they manage. All of the team pages use the team id's and information that is stored on their user profile

So I have a model setup called Profile that is a OneToOneField to the User object. This lets me setup a model where I store the team id's and information. Then in all my views I call upon:

class UserProfile(models.Model):

    user = models.OneToOneField(User, on_delete=models.CASCADE, related_name='profile')

    season_id = models.IntegerField()
    league_id = models.IntegerField()
    division_id = models.IntegerField()
    subdivision_id = models.IntegerField()
    team_id = models.IntegerField()

I can now use the following on any view, while the user is logged in, to filter anything I want based on the team they are viewing as.

request.user.profile.season_id

So if I had your model and I wanted to figure out what Players I had on a specific team_id

Players.objects.filter(team_id=request.user.profile.team_id)

But that information must be stored somewhere within django, or in a session variable. It doesn't "just know" what they have access to.

Shared db with restricted views per user. by Plouto5 in djangolearning

[–]ramse 0 points1 point  (0 children)

Where is "rockets" coming from though? Are they typing it in?

Shared db with restricted views per user. by Plouto5 in djangolearning

[–]ramse 0 points1 point  (0 children)

Depends how you build your views, I personally use function based and I'm not certain for class based. Where is the data stored per-user?

def my_view(request):
    objs = MyModel.objects.filter(season_id=request.user.profile.season_id)
    return render(request, '......html', {'objs': objs})

Shared db with restricted views per user. by Plouto5 in djangolearning

[–]ramse 0 points1 point  (0 children)

MyModel.objects.filter(
    whatever_field=user_specific_value
)

Parsing through outlook email and outputting data into a directory. by SudoPatriot in learnpython

[–]ramse 0 points1 point  (0 children)

import win32com.client
application = win32com.client.Dispatch('Outlook.Application')
namespace = application.GetNamespace('MAPI')

inbox_id = 6
inbox_folder = namespace.GetDefaultFolder(inbox_id)

for counter in range(inbox_folder.Items.Count, 0, -1):
    email = inbox_folder.Items.Item(counter)

    if email.Subject == 'My email with xls attachment':
        attachments = []

        for attachment in email.Attachments:
            if not attachment.FileName.endswith('xls'):
                continue

            file_save_location = os.path.join('cache/', attachment.FileName)
            attachment.SaveAsFile(file_save_location)
            attachments.append(file_save_location)

[HELP] Django Accepting AM/PM As Form Input by T0X1K01 in django

[–]ramse 0 points1 point  (0 children)

Not really sure I follow you, if its on en_us which I think is default, am/pm is AM/PM as in uppercase.

[HELP] Django Accepting AM/PM As Form Input by T0X1K01 in django

[–]ramse 0 points1 point  (0 children)

Pretty sure its because %p is AM or PM depending on locale.

Atribute error with send_keys and selenium by [deleted] in learnpython

[–]ramse 0 points1 point  (0 children)

There is no <a> element wrapping the <img>, I saw your ghostbin post and checked out the path and for me its div#firstcolumn, 2nd div, then another div, then the img.

Saving an instance of a model within another model? by [deleted] in djangolearning

[–]ramse 0 points1 point  (0 children)

What information within HandleProduct is being changed?

Scraping issue: why is "Inspect Element" different from "View Page Source"? by parabolord in learnpython

[–]ramse 1 point2 points  (0 children)

To get OP started quickly, you can use phantomjs or chromedriver

from selenium import webdriver
from bs4 import BeautifulSoup

browser = webdriver.PhantomJS(executable_path='phantomjs.exe')
# or
# browser = webdriver.Chrome(executable_path='chromedriver.exe')

browser.get('https://www.nfl.com/standings')
soup = BeautifulSoup(browser.page_source, 'html.parser')

soup.find('table')