atrpm 3 Posted September 4, 2019 Posted September 4, 2019 (edited) I have been working on a python script to pull file changes from GDrive using google’s api, get the file info and send a request to emby’s api to update the file path via the library/media/updated endpoint.So far I have been able to successfully do this, script have been running with no issues for 24 hrs before I make it public there are a few improvements that I have to make.I have tested this on a windows machine, I would like to find a few ppl with different OS to make sure that it works fine there, so please is interested send a PM.I do have an Emby related question, after a request has been sent and media is scheduled to be refreshed, what happens if the server is restarted before that task is completed? Here is the github link: https://github.com/atrpm/emby_gdrive_autoscan Edited September 5, 2019 by atrpm 2
Luke 39614 Posted September 4, 2019 Posted September 4, 2019 Hi, if it's restarted then you'll have to send it again or just wait for the next library scan.
atrpm 3 Posted September 4, 2019 Author Posted September 4, 2019 Hi, if it's restarted then you'll have to send it again or just wait for the next library scan. Luke if I send the path including the file name, will emby only scan that file or will it still scan the entire directory?
Luke 39614 Posted September 4, 2019 Posted September 4, 2019 Depends. In some cases it will scan the entire directory.
atrpm 3 Posted September 5, 2019 Author Posted September 5, 2019 Updated the post with the github link.
drmikewest 0 Posted October 5, 2019 Posted October 5, 2019 (edited) Thank you for this and a quick question. Configuring the config.json file, but I am not sure what to insert in this field: driveId - google drive ID What do I use for the "Google Drive ID" I have tried various iterations of my Gsuite login (xyz@@abc.com) but to no avail. Should I rather be using something else? Hope this question makes sense... Edited October 5, 2019 by drmikewest
Luke 39614 Posted October 5, 2019 Posted October 5, 2019 What config.json file? I have no idea what you mean, sorry.
drmikewest 0 Posted October 5, 2019 Posted October 5, 2019 What config.json file? I have no idea what you mean, sorry. From the github page: https://github.com/atrpm/emby_gdrive_autoscan Installation, Step 5: Configure the config.json. (do this before moving on) In the config.json is a field: "driveId": "insert drive id here" [i'm at a loss as to what I should insert as my drive id?] When I run the scan.py script, I receive the following error: File "scan.py", line 19 print(f'Starting scan for: {drive.driveId}') ^ SyntaxError: invalid syntax Hoping that's a little clearer and makes somewhat more sense?
Luke 39614 Posted October 5, 2019 Posted October 5, 2019 Ok sorry I don't know very much about this tool but perhaps there is someone here that does. Thanks.
drmikewest 0 Posted October 5, 2019 Posted October 5, 2019 Ok sorry I don't know very much about this tool but perhaps there is someone here that does. Thanks. Thanks anyways. Hoping @@atrpm sees this...
atrpm 3 Posted October 6, 2019 Author Posted October 6, 2019 Thanks anyways. Hoping @@atrpm sees this... The google drive id (as google calls it in its API documentation) is the folder ID where your media is store at. The way that I found mine was from the URL, after the folder path ex. https://drive.google.com/drive/folders/drive-id-should-be-here. So, if you go into the folder from your web browser you should be able to find it. Also, I just push so bug fixes so make sure to get the latest code.
atrpm 3 Posted October 6, 2019 Author Posted October 6, 2019 Here is a great example. https://ploi.io/documentation/mysql/where-do-i-get-google-drive-folder-id
saitoh183 137 Posted March 4, 2020 Posted March 4, 2020 @atrpm How can i use this on a headless ubuntu server? cant get pass the authorized application stage as i get a error because it is not done on the same machine. Couldn't you do like rclone or plexdrive did by using a response token that we can paste into terminal? Was all excited to use this
saitoh183 137 Posted March 5, 2020 Posted March 5, 2020 @atrpm How can i use this on a headless ubuntu server? cant get pass the authorized application stage as i get a error because it is not done on the same machine. Couldn't you do like rclone or plexdrive did by using a response token that we can paste into terminal? Was all excited to use this fixed on git...thanks!
M3th0s 14 Posted March 9, 2020 Posted March 9, 2020 Can I use this to scan team drives? That being the case 2 questions: Can I point this towards the root "Media" folder in a team drive and it'll still do its work? Can I set this up with multiple team drives? Thanks in advance
atrpm 3 Posted March 9, 2020 Author Posted March 9, 2020 Can I use this to scan team drives? That being the case 2 questions: Can I point this towards the root "Media" folder in a team drive and it'll still do its work? Can I set this up with multiple team drives? Thanks in advance Yes, this works with team drives, that's how I use it. Pointing to an specific folders is not supported at the moment, you can point it to the entire drive and if a change is detected it will be send to Emby. I will do nothing since it wont find a match for that path. Yes, you can set it up for multiple drives. I have not test this since I don't use multiple drives but in the config file, the drives section is a json array, you can add multiple ones, like this: "drives": [ { "driveId": "insert drive id here", "currentPageToken": null, "pageSize": 100, "changesStartDate": "2019-09-04T00:00:00", "credentialsPath": "credentials.json", "includeItemsFromAllDrives": true, "supportsAllDrives": true, "includeRemoved": true, "physicalDriveMountLetter": null, "mountPoint": null, "retries": 3 }, { "driveId": "drive 2", "currentPageToken": null, "pageSize": 100, "changesStartDate": "2019-09-04T00:00:00", "credentialsPath": "credentials2.json", "includeItemsFromAllDrives": true, "supportsAllDrives": true, "includeRemoved": true, "physicalDriveMountLetter": null, "mountPoint": null, "retries": 3 } ],
M3th0s 14 Posted March 9, 2020 Posted March 9, 2020 Yes, this works with team drives, that's how I use it. Pointing to an specific folders is not supported at the moment, you can point it to the entire drive and if a change is detected it will be send to Emby. I will do nothing since it wont find a match for that path. Yes, you can set it up for multiple drives. I have not test this since I don't use multiple drives but in the config file, the drives section is a json array, you can add multiple ones, like this: "drives": [ { "driveId": "insert drive id here", "currentPageToken": null, "pageSize": 100, "changesStartDate": "2019-09-04T00:00:00", "credentialsPath": "credentials.json", "includeItemsFromAllDrives": true, "supportsAllDrives": true, "includeRemoved": true, "physicalDriveMountLetter": null, "mountPoint": null, "retries": 3 }, { "driveId": "drive 2", "currentPageToken": null, "pageSize": 100, "changesStartDate": "2019-09-04T00:00:00", "credentialsPath": "credentials2.json", "includeItemsFromAllDrives": true, "supportsAllDrives": true, "includeRemoved": true, "physicalDriveMountLetter": null, "mountPoint": null, "retries": 3 } ], I'm using this on ubuntu 18.04 with an rclone mount, so rather than drive guessing I'd be pointing this to the mount point? Thanks again for your help!
tattoomees 2 Posted March 9, 2020 Posted March 9, 2020 if i "mountPoint": null, change "mountPoint": /mnt/unionfs , do i stilll need credencials and drive id ?
atrpm 3 Posted March 9, 2020 Author Posted March 9, 2020 I'm using this on ubuntu 18.04 with an rclone mount, so rather than drive guessing I'd be pointing this to the mount point? Thanks again for your help! They are different things. mount point and folder are not related in terms of this script. The setting mountPoint for the drive in the config.json has to match the rclone mount point on the system otherwise it will not work.
M3th0s 14 Posted March 9, 2020 Posted March 9, 2020 They are different things. mount point and folder are not related in terms of this script. The setting mountPoint for the drive in the config.json has to match the rclone mount point on the system otherwise it will not work. Sorry just noticed there's a mountpoint variable
atrpm 3 Posted March 9, 2020 Author Posted March 9, 2020 if i "mountPoint": null, change "mountPoint": /mnt/unionfs , do i stilll need credencials and drive id ? Yes, the script needs a way to connect to the google drive api and query for changes. The script uses mountPoint to generate the complete system path and let emby know to go and scan that directory. Ex. From google drive api what we get is that something changed in folderId/Media/Movie/SomeMovieFolder. The script needs to convert that to /mnt/myMount/Media/Movie/SomeMovieFolder or in windows D:/Media/Movie/SomeMovieFolder. Hope that helps.
tattoomees 2 Posted March 9, 2020 Posted March 9, 2020 do you have fully working sample file without credencials its bit confusig .
atrpm 3 Posted March 9, 2020 Author Posted March 9, 2020 do you have fully working sample file without credencials its bit confusig . Sure, Are you using Windows or Linux? How are you mounting the drive? (rclone or something else) What is your mount point and or letter (if windows)? Is this for a Team Drive (Shared Drive) or a Personal Drive?
M3th0s 14 Posted March 9, 2020 Posted March 9, 2020 (edited) Sure, Are you using Windows or Linux? How are you mounting the drive? (rclone or something else) What is your mount point and or letter (if windows)? Is this for a Team Drive (Shared Drive) or a Personal Drive? Hello again I keep getting File "scan.py", line 19 print(f'Starting scan for: {drive.driveId}') ^ SyntaxError: invalid syntax Working on a headless machine, so changed that to true. Config json is there, but no dice. Any help appreciated Edited March 9, 2020 by M3th0s
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now