Coder Social home page Coder Social logo

No specific User Agent for SageTV about sagetv HOT 8 CLOSED

google avatar google commented on July 26, 2024
No specific User Agent for SageTV

from sagetv.

Comments (8)

Narflex avatar Narflex commented on July 26, 2024

One thing I'm not following....is can't this already be done using the StartFileDownload API call? It sounds like #2 is already implemented. Take a look at the overloaded StartFileDownload API call in sage/api/Global.java. IIRC, that's why I added that argument in the first place. :)

And the main reason this was never set as the default was I didn't want SageTV getting blacklisted from specific sites.

from sagetv.

CraziFuzzy avatar CraziFuzzy commented on July 26, 2024

At a glance, it didn't look like StartFileDownload actually passed through anything but ServerAddress, SourceFile, and DestFile when it calls downloadFile.

from sagetv.

CraziFuzzy avatar CraziFuzzy commented on July 26, 2024

On another look, it looks like StartBackgroundFileDownload handles the props...

from sagetv.

CraziFuzzy avatar CraziFuzzy commented on July 26, 2024

but StartFileDownload and StartCircularFileDownload do not.

from sagetv.

Narflex avatar Narflex commented on July 26, 2024

Ahh yes, you are correct. :)

OK, I'd propose making 2 changes then.

  1. Have a property such as "use_sagetv_user_agent" which then uses "SageTVa.b.c" as the user agent (and it would default to not being on for backwards compatibility)
  2. Add an overloaded StartFileDownload API call which takes a RequestProperties parameter so this can force the user agent to whatever it wants.

That all sound good?

from sagetv.

CraziFuzzy avatar CraziFuzzy commented on July 26, 2024

Sounds prefect. I had originally envisioned a single property that would simply override the user agent all the time, but later realized this would not really be proper, and any workaround user agent spoofing should be done on a case by case basis, so this solution should work best. Default to old behavior, ideal having the property turned on which would have a "proper" default SageTV user agent, and provide a case by case way to workaround individual site issues with a spoofed user agent.

So, this would require downloadFile to generate a default, and apply it, if desired by global property, BEFORE the requestProps are iterated through. Then the addition to the other Global API calls to pass through the props if there.

from sagetv.

CraziFuzzy avatar CraziFuzzy commented on July 26, 2024

Looks like I'll need some help if I'm going to complete this issue. I'm not sure how, or if, the API functions CAN be overloaded. Or at least if they can, I'm not sure about the way to go about doing so. This leaves the only option to create a new API call (StartFileDownloadWithProps) with the properties attached. I'm guessing there's no problem with doing this, it just means that any stv's or libraries that might benefit from the change will have to make sure to use the proper call.

from sagetv.

Narflex avatar Narflex commented on July 26, 2024

Take a look at the "SageCommand" API call in Global.java. That gives you an example of how it's done. The few things you need to notice are:

  1. The # of parameters for the method is declared as -1 (in the constructor)
  2. It uses the 'curNumberOfParameters' variable to determine how many arguments there are and then does the appropriate thing after that.
  3. There's 2 javadoc comments, one for each method

from sagetv.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.