Commit graph

72 commits

Author SHA1 Message Date
MoojMidge
5782e7b257 Tidy up some exception catching 2024-04-03 03:33:07 +11:00
MoojMidge
3460a6f617 Fixes to allow alternate 2 client details to work 2024-03-31 02:47:37 +11:00
MoojMidge
bea3ba442d Add and use utils.methods.jsonrpc helper method 2024-03-27 15:05:33 +11:00
MoojMidge
c36f6c8d3d Use monitor.waitForAbort for waiting/sleeping 2024-03-27 15:01:07 +11:00
MoojMidge
bdf2c0762b Overhaul http server settings management to potentially fix #633
- Improve/consolidate settings methods and split up non-settings related actions
- Validate IP address and port number user inputs
- Check correct private IPv4 private ranges
- Check what network interface the nominated listen address is available on
- Configure default listen address in setup wizard
- Use correct conditions to check whether http server should run
- Batch process settings changes in ServiceMonitor.onSettingsChanged rather than passing notifications back and forth
2024-03-17 15:45:21 +11:00
MoojMidge
a8a660a4bc Use xbmc.getCondVisibility rather than JSON-RPC to check Kodi boolean settings 2024-03-13 01:43:31 +11:00
MoojMidge
705a4f686e Fix Python2 var-positional arguments SyntaxError 2024-02-25 11:30:34 +11:00
MoojMidge
bebc9c7746 Fix utils.methods.rm_dir and make_dirs not creating/removing plugin temp dir 2024-02-22 13:47:52 +11:00
MoojMidge
3b4289db64 Update path and uri creation methods
- Simplify AbstractContext.create_uri
- Extend utils.methods.create_path to optionally create uri paths
- Remove utils.methods.create_uri_path
2024-02-22 13:47:41 +11:00
MoojMidge
180ce7afa6 Simplify kodion.utils.methods.loose_version
- Also simplify XbmcContext.inputstream_adaptive_capabilities and
  pre-compute ISA capability loose version values
2024-02-22 13:47:16 +11:00
MoojMidge
b0a01abe87 Do not decode str in Python3 kodion.utils.methods.to_unicode 2024-02-22 13:47:11 +11:00
MoojMidge
d2512e41f5 Misc tidy up 2024-02-22 13:47:03 +11:00
MoojMidge
bdba435bd9 Remove unused kodion.utils.methods.to_str 2024-02-15 21:06:08 +11:00
MoojMidge
e50cfbe3c5 Use constants.paths rather than hardcoded paths for comparisons 2024-02-05 10:38:10 +11:00
MoojMidge
884c35d515 Fix for AccessManager data not being updated 2024-01-14 13:14:45 +11:00
MoojMidge
e4dc267025 Fix checking str type in Python 2 2024-01-14 13:14:38 +11:00
MoojMidge
14bfaf3e30 Add as_str=True param to friendly_number
- Only return tuple of output and processed input value when necessary
2024-01-01 18:20:03 +11:00
MoojMidge
645bb3eb4f Simplify utils.methods.make_dirs add rm_dir
- Also make code Python 2 compatible (remove exist_ok param in os.makedirs)
2023-12-26 11:14:59 +11:00
MoojMidge
af1738e295 Remove use of hardcoded temp and data path
- make_dirs returns translated path on success
  - Use to check/create/get in one go
- Rename native_path to addon_path
- Use os.path.join rather than hardcoding path seperators
- Fix unnecessarily nested os.path.join calls
2023-12-25 20:43:19 +11:00
MoojMidge
14099bd9f2 Update type/attr/key checking
- Allow passing tuples and dict.keys instead of only lists as parameters
- Other misc fixes to prevent possible exceptions
2023-12-17 04:05:06 +11:00
MoojMidge
b16e5ac5b1 Kodi Leia compatibility 2023-12-12 00:18:25 +11:00
MoojMidge
34851601fe Remove/add Unicode encoding/decoding
- Additions required for Python 2/3 compatibility
- Removals not required for Python 3
  - Will require use of kodi-six in Kodi Leia
2023-12-11 16:01:30 +11:00
MoojMidge
7a0ce7b7a4 Add get_kodi_setting method 2023-12-11 01:35:25 +11:00
MoojMidge
ea63dfdad6 Make merge_dicts a common utils method 2023-12-11 00:03:40 +11:00
MoojMidge
72480b5b5c Support Youtube Clips
- Closes #450
- Support following plugin url formats:
  - plugin://plugin.video.youtube/uri2addon/?uri=https://www.youtube.com/clip/<clip_id>
  - plugin://plugin.video.youtube/play/?video_id=<video_id>&start=<start_time>&end=<end_time>&clip=true
- optional clip parameter will loop the clip between start_time and end_time, otherwise video will stop after end_time is reached
2023-12-07 19:13:41 +11:00
MoojMidge
e16c7a0581 Rationalise item date and duration methods
- use datetime objects for setting rather than parsing back and forth
- date and dateadded values stored as datetime rather than str
- date and dateadded getter can retrieve value as datetime, date str or datetime.isoformat
- aired and premiered values stored as date rather than st
- aired and premiered getter can retrieve value as date, or date.isoformat
- datetime_parser.parse will always create a datetime object rather than a date object
  - the caller can determine whether datetime.date() needs to be used after that
- duration getter can optionally retrieve value as hh:mm:ss string
- listitem label2 now uses the same data as default label mask including date and duration
2023-12-07 18:13:09 +11:00
MoojMidge
bf7b12a57d Improve video stats display
- Fix incorrect duration of upcoming videos
- Fix imdbnumber being saved to incorrect info label
- Add view count to listitem info and sort methods
- Add rating to listitem info and sort method based on made up ranking
- Add label masking to sort methods
2023-12-07 18:12:02 +11:00
MoojMidge
4e4e2e6e1b Remove references to xbmc.translatePath
- Also remove unnecessary decode to unicode
- Future backports for Kodi 18 to use six/future
2023-12-06 15:24:56 +11:00
MoojMidge
4bc2d3943e Consolidate localisation ids
- Move LOCAL_MAP from provider to context as that is where it is used
- Remove const_localize (redundant when using LOCAL_MAP)
- Remove _local_map (redundant when using LOCAL_MAP)
- Update and sort id names
- Replace hardcoded integer ids with id names
- Tidy up provider
2023-12-06 15:24:52 +11:00
MoojMidge
c542880f4f Retrieve and display video stats
- Existing "Show channel name in description" option changed to
  "Show channel name and video details in description"
- Displays number of views, likes, comments in description if enabled
- Displays stats and premiere datetime in label2
- Closes #503, #18
2023-12-06 15:24:41 +11:00
MoojMidge
86d1792d30 ISA - fix logic & naming for text, vars and methods
- IA to ISA, ia to isa, adaptive to isa
- MPD to ISA, mpd to isa when non MPEG-DASH specific
- new HLS/hls variables and methods for HLS specific functionality
2023-12-01 01:11:34 +11:00
MoojMidge
0466d93b23 Misc optimisations and refactoring
Needs testing for regressions
2023-12-01 01:11:28 +11:00
MoojMidge
533fc96c54 Misc tidy up
No (intended) functional changes:
- extraneous indentation/whitespace
- missing explicit return values
- unnecessary return values
- combine nested if statements
- else/elif after return
- change else if to elif
- change if X: to if not X: return
- use conditional expressions
- simplify redundant conditions in if statements
- change bool if condition else not bool to just condition
- remove u-strings
- remove unused variables
- reduce line lengths
2023-11-25 22:15:34 +11:00
MoojMidge
83275ed2ba Move get_language_name to kodion context class 2023-06-21 00:04:02 +10:00
MoojMidge
a17d442ced Fix sorting of stream chooser
Sorts based on:
- quality
- preferred language
- original language
- language name (in English...)
2023-06-21 00:03:58 +10:00
MoojMidge
3834a94344 Improve MPD manifest language sorting
- ISA will still override this and sort by bandwidth
2023-06-20 17:42:15 +10:00
MoojMidge
5bbca4b678 Fix evaluation of single ISA capability 2023-06-19 23:42:17 +10:00
MoojMidge
bb2e46edd1 Implement original single stream live HLS playback 2023-05-28 20:19:23 +10:00
MoojMidge
6264b408f7 Enable HLS and adaptive HLS live streams 2023-05-25 21:46:18 +10:00
MoojMidge
546fb9ea33 Fix potential TypeError when sort key is missing 2023-05-05 14:45:52 +10:00
anxdpanic
c59ec823f4 remove dependency on six 2023-02-25 14:46:23 -05:00
anxdpanic
f1f4445fac remove python version related if statements 2023-02-25 14:02:24 -05:00
RNavega
260b901578
Expose new to_str from methods.py 2021-08-30 03:59:22 -03:00
anxdpanic
4fdfdfdd60 make comment fix py2 compatible 2021-08-22 16:48:46 -04:00
anxdpanic
696687e459 fixup translatePath in Kodi 19 nightlies 2020-09-11 09:21:57 -04:00
anxdpanic
d4b127741b resolve unused local variables 2018-12-21 14:42:50 -05:00
anxdpanic
63ef799dbb fix unresolved references 2018-12-21 14:42:49 -05:00
anxdpanic
903663db0e refactor keymap path and video id checks 2018-12-20 10:19:32 -05:00
anxdpanic
5175da5799 [PEP263] add source code encoding magic comment 2018-12-17 13:56:49 -05:00
anxdpanic
0ceb8246c2 Use SPDX license identifiers 2018-12-17 13:32:47 -05:00