Coder Social home page Coder Social logo

jdaymude / xbox2local Goto Github PK

View Code? Open in Web Editor NEW
8.0 8.0 2.0 56 KB

A command line utility for downloading Xbox screenshots and game clips to local storage

License: MIT License

Python 100.00%
game-clip gaming onedrive screenshot utility xbox

xbox2local's People

Contributors

jdaymude avatar ktiedt avatar spiffomatic64 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

xbox2local's Issues

Change filename format to human-readable date

Description
Currently, downloaded screens and clips are named according to their capture time in seconds since the epoch. This isn't great for readability. Update this to be yyyy-mm-ddThh-mm-ss.

Upgrade history structure from JSON lists to pandas

Description
Currently, the history.json file only stores lists of contentIds for previously downloaded screenshots and gameclips. Other interesting metadata about the media (date/time of capture, URI, etc.) is either lost or embedded in the filename, which isn't immediately accessible. This could be improved by splitting the history into two files, screenshots.csv and gameclips.csv that represent pandas DataFrames storing all the relevant metadata about downloaded entries.

As an aside, this may also help with the long-term goal of minimizing the number of API calls as described in #3.

Can you help develop and maintain this feature?
Yes.

Enable multi-user support

Description
In the situation where xbox2local is used on one device for different accounts, a more robust approach to multi-user support is needed. In particular, the current design causes history files to conflict.

Raise Error 403 when X API rate limit is exceeded

Description
Unlike what is stated in the README, xbox2local does not actually raise the ERROR 403 error when the X API rate limit is exceeded. This needs to be implemented appropriately and caught whenever any X API call in xbox2local may reach the limit.

Can you help develop and maintain this feature?
Yes.

Preserving creation metadata fails to accurately track date times.

Description
Looking at the results from this code today, it does not appear to be working correctly. In the screenshot here you can see there are now dates from in the future which were taken today. I also was not creating clips at 1am... Is there a timezone issue not being taken into account from the API maybe?

Screen Shot 2023-06-15 at 12 46 26 PM

To Reproduce
Steps to reproduce the behavior:

  1. Just use the latest version, dates will be wrong.
  2. See error

Expected Behavior
Dates should align with the current data and reality, ie: not assign dates in the future.

Extend support to non-curl/wget-friendly command lines

Description
xbox2local makes all its X API calls using curl and downloads all media using wget. So despite being a Python script that runs anywhere Python is installed, these commands will of course fail on any command lines where curl and wget are not present or have different syntax. Support and testing need to be extended for command lines where other utilities are used for URL access.

Can you help develop and maintain this feature?
Yes.

No API key provided or invalid API key error.

Description
I don't know if anything changed on X API's side or what, since i only know the basics about APIs, but i been trying to use this now and can't seem to make it work.

To Reproduce

  1. Set up my API key from X API
  2. Run `python xbox2local.py with the username of my users folder
  3. Always get 401 error

Expected Behavior
It should be able to access the API with that key but it doesn't work.

Platform
"windows-cmd"

Detect and download HDR media

Description
Screenshots made on the Xbox One S, Xbox One X, and Xbox Series X|S or a Windows 10/11 PC connected to an HDR10 display create two versions of the media on Xbox Live: standard and HDR. xbox2local currently only downloads the standard versions, but this should be extended. Filenames can be simply extended from standardname.png to standardname_hdr.jxr.

As of this writing, game clips do not have HDR captures.

Can you help develop and maintain this feature?
Yes.

Delete downloaded media from Xbox Live

Description
It may be the case that not all users want to have their screenshots and game clips remain on Xbox Live after they download them. A nice enhancement would be for xbox2local to optionally delete downloaded media from Xbox Live after successfully downloading it, e.g., with a new optional command line argument --delete_after_downloading.

However, neither X API nor the actual Xbox Live Services RESTful API seem to support this at the moment.

Can you help develop and maintain this feature?
Yes.

X API's upstream move to Cloudfare breaks 2FA Microsoft accounts

Description
When attempting to sign into X API with my Microsoft account so xbox2local can call its APIs, I received the following message:

This has been disabled, as the move to Cloudflare has broken this. Please instead save your logins, and if you have 2FA enabled, create a dummy account.

Because my Microsoft account uses 2FA and I'm not particularly interested in removing that security just to get an Xbox API to work, xbox2local cannot access my Xbox account data.

To Reproduce
Steps to reproduce the behavior:

  1. Sign into X API with your X API account.
  2. Navigate to the settings menu.
  3. Attempt to "Sign in to Xbox Live".

Expected Behavior
xbox2local is working as intended; the issue is upstream.

Optimize the number of X API calls for large media libraries

Description
As described in the README under Troubleshooting and Gotchas ERROR 403, xbox2local calls the X API once for authentication, once per page of screenshot results, and once per page of game clip results each time it is run. For users with large media libraries on Xbox Live, this may exceed the 60 requests per hour allowed by X API's free tier. The suggested workaround of using --media_type to download screenshots and game clips in separate xbox2local calls (straddling over an hour reset) still may not solve the problem since some users may have over 60 pages of results for screenshots or game clips independently.

Since results pages are served in reverse-chronological order, a first improvement would stop xbox2local from querying result pages if it has reason to believe that all older pages are results it has already downloaded. This would require an extension of the download_history.json file, most likely. However, this does not solve the problem of first-time users with large media libraries; it only helps users who start with libraries small enough to be managed by the 60 requests per hour that may outgrow this limit over time.

Alternatively, with some research into how pagination and continuationToken information is structured, it may be possible to let the user provide a date to start downloading from, skipping unwanted calls. This is more amorphous though, and I'm not sure how it would actually work.

Can you help develop and maintain this feature?
Yes.

Preserve file creation meta data on the file itself

Description
Currently, if you download your media using xbox2local, all files will be named for their creation timestamp, but all have essentially the same file creation date history on the OS... It is possible to modify these values using python, it would be a nice bonus if xbox2local could preserve this data in a way that keeps your media sorted based on when it was actually created (outside of the file name), which would enable OS level file searching, filtering, to be usable then as well for managing backups.

Can you help develop and maintain this feature?
Maybe - Python isn't my primary language, so I am having to relearn things trying to make this work, if I solve it, I will absolutely create a pull request, but right now, I am about 0 / 5 on attempts at anything that doesn't throw new errors.

Organize downloaded media by game

Description
Currently, the downloaded media are given filenames based on the time they were taken/recorded, yielding a chronological organization. It would be nice to enhance this further by organizing media by game:

local_dir
|---- game1_name
|---- |---- media1_time.png
|---- |---- ...
|---- ...
|---- gamen_name
|---- |---- media1_time.png
|---- |---- ...

Can you help develop and maintain this feature?
Yes.

Datetime processing fails on microseconds

Just downloaded and set things up, really straight forward, so thanks for a great project so far, however, I did run into this error which seems new here...

My python is a bit rusty, but, if I find a work around, I'll append an PR to address it, if it makes sense.

Scanning the Xbox network for screenshots...
Scanning the Xbox network for game clips...
Traceback (most recent call last):
  File "/Users/ktiedt/repos/2023/xbox2local/xbox2local.py", line 179, in <module>
    capture_dt=fmt_datetime(clip['contentSegments'][0]['recordDate']),\
  File "/Users/ktiedt/repos/2023/xbox2local/xbox2local.py", line 73, in fmt_datetime
    raise ValueError('ERROR: No valid date format for \'' + datestr + '\'')
ValueError: ERROR: No valid date format for '2023-03-16T03:39:09.432Z'

Some games seem invisible to APIs.

Description
The xbox2local script appears to be performing correctly for most all games, but there are some that are not surfaced by X API. In particular, I've experienced this with Sea of Thieves, though there may be other titles as well. However, those screenshots and game clips are definitely uploaded to Xbox Live and are visible on first- and third-party services like the Xbox iOS app, GameDVR, etc. This seems to be upstream (X API) since even the direct curl calls do not surface any metadata, however.

To Reproduce
Steps to reproduce the behavior:

  1. Take game media in a problematic game, like Sea of Thieves.
  2. Ensure that those game media are uploaded to Xbox Live.
  3. Run xbox2local and observe that the media is not downloaded.

Expected Behavior
All game media should be downloaded.

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.