l3uddz / cloudplow

Automatic rclone remote uploader, with support for multiple remote/folder pairings. UnionFS Cleaner functionality: Deletion of UnionFS whiteout files and their corresponding files on rclone remotes. Automatic remote syncer: Sync between different remotes via a Scaleway server instance, that is created and destroyed at every sync.
GNU General Public License v3.0
344 stars 46 forks source link

Add local check before throttling #76

Closed bigbozza closed 4 years ago

bigbozza commented 4 years ago

I host locally and it was bothering me that when I was watching locally, it was throttling my uploads unnecessarily.

I made changes to the main cloudplow.py and utils/plex.py so that it doesn't count them. I think it would be a good option for those of us who aren't 100% cloud.

In the PlexStream class from plex.py: if 'Player' in stream: self.player = stream['Player']['product'] self.ip = stream['Player']['remotePublicAddress'] self.local = stream['Player']['local']

And at the bottom of plex.py: return u"{user} is playing {media} using {player}. " \ "Stream state: {state}, type: {type}, local: {local}.".format(user=self.user, media=self.title, player=self.player, state=self.state, type=stream_type, local=self.local)

In the do_plex_monitor logic from cloudplow.py

stream_count = 0 for stream in streams: if stream.state == 'playing' or stream.state == 'buffering': stream_count += 1 if stream.local == 1: stream_count -= 1

desimaniac commented 4 years ago

Added in https://github.com/l3uddz/cloudplow/commit/97702c82c1cafeae99f4b1c1a83b614fa2743c07