django-pbsmmapi 1.3.4b0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. django_pbsmmapi-1.3.4b0/.gitignore +72 -0
  2. django_pbsmmapi-1.3.4b0/LICENSE +20 -0
  3. django_pbsmmapi-1.3.4b0/PKG-INFO +83 -0
  4. django_pbsmmapi-1.3.4b0/README.md +51 -0
  5. django_pbsmmapi-1.3.4b0/pbsmmapi/__init__.py +1 -0
  6. django_pbsmmapi-1.3.4b0/pbsmmapi/abstract/__init__.py +0 -0
  7. django_pbsmmapi-1.3.4b0/pbsmmapi/abstract/admin.py +64 -0
  8. django_pbsmmapi-1.3.4b0/pbsmmapi/abstract/helpers.py +26 -0
  9. django_pbsmmapi-1.3.4b0/pbsmmapi/abstract/models.py +639 -0
  10. django_pbsmmapi-1.3.4b0/pbsmmapi/api/__init__.py +0 -0
  11. django_pbsmmapi-1.3.4b0/pbsmmapi/api/api.py +28 -0
  12. django_pbsmmapi-1.3.4b0/pbsmmapi/api/helpers.py +21 -0
  13. django_pbsmmapi-1.3.4b0/pbsmmapi/asset/__init__.py +0 -0
  14. django_pbsmmapi-1.3.4b0/pbsmmapi/asset/admin.py +140 -0
  15. django_pbsmmapi-1.3.4b0/pbsmmapi/asset/apps.py +6 -0
  16. django_pbsmmapi-1.3.4b0/pbsmmapi/asset/helpers.py +71 -0
  17. django_pbsmmapi-1.3.4b0/pbsmmapi/asset/migrations/0001_initial.py +294 -0
  18. django_pbsmmapi-1.3.4b0/pbsmmapi/asset/migrations/0002_move_assets_data.py +75 -0
  19. django_pbsmmapi-1.3.4b0/pbsmmapi/asset/migrations/0003_remove_asset_images_json.py +16 -0
  20. django_pbsmmapi-1.3.4b0/pbsmmapi/asset/migrations/0004_alter_asset_date_last_api_update.py +25 -0
  21. django_pbsmmapi-1.3.4b0/pbsmmapi/asset/migrations/0005_remove_asset_object_type_asset_asset_type.py +26 -0
  22. django_pbsmmapi-1.3.4b0/pbsmmapi/asset/migrations/0006_asset_franchise.py +29 -0
  23. django_pbsmmapi-1.3.4b0/pbsmmapi/asset/migrations/0007_alter_asset_id.py +23 -0
  24. django_pbsmmapi-1.3.4b0/pbsmmapi/asset/migrations/0008_remove_asset_windows_alter_asset_availability_and_more.py +90 -0
  25. django_pbsmmapi-1.3.4b0/pbsmmapi/asset/migrations/0009_alter_asset_options.py +21 -0
  26. django_pbsmmapi-1.3.4b0/pbsmmapi/asset/migrations/__init__.py +0 -0
  27. django_pbsmmapi-1.3.4b0/pbsmmapi/asset/models.py +342 -0
  28. django_pbsmmapi-1.3.4b0/pbsmmapi/asset/tasks.py +45 -0
  29. django_pbsmmapi-1.3.4b0/pbsmmapi/changelog/__init__.py +0 -0
  30. django_pbsmmapi-1.3.4b0/pbsmmapi/changelog/apps.py +6 -0
  31. django_pbsmmapi-1.3.4b0/pbsmmapi/changelog/migrations/0001_initial.py +112 -0
  32. django_pbsmmapi-1.3.4b0/pbsmmapi/changelog/migrations/__init__.py +0 -0
  33. django_pbsmmapi-1.3.4b0/pbsmmapi/changelog/models.py +199 -0
  34. django_pbsmmapi-1.3.4b0/pbsmmapi/changelog/tasks.py +420 -0
  35. django_pbsmmapi-1.3.4b0/pbsmmapi/episode/__init__.py +0 -0
  36. django_pbsmmapi-1.3.4b0/pbsmmapi/episode/admin.py +144 -0
  37. django_pbsmmapi-1.3.4b0/pbsmmapi/episode/apps.py +6 -0
  38. django_pbsmmapi-1.3.4b0/pbsmmapi/episode/forms.py +21 -0
  39. django_pbsmmapi-1.3.4b0/pbsmmapi/episode/migrations/0001_initial.py +521 -0
  40. django_pbsmmapi-1.3.4b0/pbsmmapi/episode/migrations/0002_auto_20190430_1853.py +34 -0
  41. django_pbsmmapi-1.3.4b0/pbsmmapi/episode/migrations/0003_auto_20190430_1926.py +22 -0
  42. django_pbsmmapi-1.3.4b0/pbsmmapi/episode/migrations/0004_auto_20190430_1949.py +22 -0
  43. django_pbsmmapi-1.3.4b0/pbsmmapi/episode/migrations/0005_remove_pbsmmepisode_live_as_of_and_more.py +20 -0
  44. django_pbsmmapi-1.3.4b0/pbsmmapi/episode/migrations/0006_remove_pbsmmepisodeasset_override_default_asset.py +16 -0
  45. django_pbsmmapi-1.3.4b0/pbsmmapi/episode/migrations/0007_remove_pbsmmepisode_canonical_image_type_override_and_more.py +20 -0
  46. django_pbsmmapi-1.3.4b0/pbsmmapi/episode/migrations/0008_remove_pbsmmepisodeasset_canonical_image_type_override.py +16 -0
  47. django_pbsmmapi-1.3.4b0/pbsmmapi/episode/migrations/0009_alter_pbsmmepisode_funder_message_and_more.py +129 -0
  48. django_pbsmmapi-1.3.4b0/pbsmmapi/episode/migrations/0010_pbsmmepisodeasset_images_json.py +22 -0
  49. django_pbsmmapi-1.3.4b0/pbsmmapi/episode/migrations/0011_delete_pbsmmepisodeasset.py +16 -0
  50. django_pbsmmapi-1.3.4b0/pbsmmapi/episode/migrations/0011_remove_pbsmmepisodeasset_chapters_and_more.py +28 -0
  51. django_pbsmmapi-1.3.4b0/pbsmmapi/episode/migrations/0012_remove_pbsmmepisode_segment.py +16 -0
  52. django_pbsmmapi-1.3.4b0/pbsmmapi/episode/migrations/0013_alter_pbsmmepisode_date_last_api_update.py +25 -0
  53. django_pbsmmapi-1.3.4b0/pbsmmapi/episode/migrations/0014_rename_pbsmmepisode_episode.py +18 -0
  54. django_pbsmmapi-1.3.4b0/pbsmmapi/episode/migrations/0015_alter_episode_id.py +23 -0
  55. django_pbsmmapi-1.3.4b0/pbsmmapi/episode/migrations/0016_alter_episode_json_alter_episode_links.py +36 -0
  56. django_pbsmmapi-1.3.4b0/pbsmmapi/episode/migrations/0017_episode_provisional.py +21 -0
  57. django_pbsmmapi-1.3.4b0/pbsmmapi/episode/migrations/0018_auto_increment_ordinal.py +40 -0
  58. django_pbsmmapi-1.3.4b0/pbsmmapi/episode/migrations/__init__.py +0 -0
  59. django_pbsmmapi-1.3.4b0/pbsmmapi/episode/models.py +148 -0
  60. django_pbsmmapi-1.3.4b0/pbsmmapi/franchise/__init__.py +0 -0
  61. django_pbsmmapi-1.3.4b0/pbsmmapi/franchise/admin.py +196 -0
  62. django_pbsmmapi-1.3.4b0/pbsmmapi/franchise/apps.py +6 -0
  63. django_pbsmmapi-1.3.4b0/pbsmmapi/franchise/forms.py +22 -0
  64. django_pbsmmapi-1.3.4b0/pbsmmapi/franchise/migrations/0001_initial.py +239 -0
  65. django_pbsmmapi-1.3.4b0/pbsmmapi/franchise/migrations/0002_alter_franchise_genre_alter_franchise_images_and_more.py +66 -0
  66. django_pbsmmapi-1.3.4b0/pbsmmapi/franchise/migrations/__init__.py +0 -0
  67. django_pbsmmapi-1.3.4b0/pbsmmapi/franchise/models.py +96 -0
  68. django_pbsmmapi-1.3.4b0/pbsmmapi/franchise/tasks.py +24 -0
  69. django_pbsmmapi-1.3.4b0/pbsmmapi/franchise/tests.py +0 -0
  70. django_pbsmmapi-1.3.4b0/pbsmmapi/franchise/views.py +0 -0
  71. django_pbsmmapi-1.3.4b0/pbsmmapi/season/__init__.py +0 -0
  72. django_pbsmmapi-1.3.4b0/pbsmmapi/season/admin.py +156 -0
  73. django_pbsmmapi-1.3.4b0/pbsmmapi/season/apps.py +6 -0
  74. django_pbsmmapi-1.3.4b0/pbsmmapi/season/forms.py +21 -0
  75. django_pbsmmapi-1.3.4b0/pbsmmapi/season/migrations/0001_initial.py +486 -0
  76. django_pbsmmapi-1.3.4b0/pbsmmapi/season/migrations/0002_auto_20190430_1853.py +27 -0
  77. django_pbsmmapi-1.3.4b0/pbsmmapi/season/migrations/0003_pbsmmseason_show_api_id.py +22 -0
  78. django_pbsmmapi-1.3.4b0/pbsmmapi/season/migrations/0004_auto_20190430_1949.py +22 -0
  79. django_pbsmmapi-1.3.4b0/pbsmmapi/season/migrations/0005_auto_20190502_1629.py +20 -0
  80. django_pbsmmapi-1.3.4b0/pbsmmapi/season/migrations/0006_remove_pbsmmseason_live_as_of_and_more.py +20 -0
  81. django_pbsmmapi-1.3.4b0/pbsmmapi/season/migrations/0007_remove_pbsmmseasonasset_override_default_asset.py +16 -0
  82. django_pbsmmapi-1.3.4b0/pbsmmapi/season/migrations/0008_remove_pbsmmseason_canonical_image_type_override_and_more.py +20 -0
  83. django_pbsmmapi-1.3.4b0/pbsmmapi/season/migrations/0009_alter_pbsmmseason_images_alter_pbsmmseason_links_and_more.py +132 -0
  84. django_pbsmmapi-1.3.4b0/pbsmmapi/season/migrations/0010_pbsmmseason_images_json_pbsmmseasonasset_images_json.py +29 -0
  85. django_pbsmmapi-1.3.4b0/pbsmmapi/season/migrations/0011_delete_pbsmmseasonasset.py +16 -0
  86. django_pbsmmapi-1.3.4b0/pbsmmapi/season/migrations/0011_remove_pbsmmseasonasset_chapters_and_more.py +28 -0
  87. django_pbsmmapi-1.3.4b0/pbsmmapi/season/migrations/0012_remove_pbsmmseason_images_json.py +16 -0
  88. django_pbsmmapi-1.3.4b0/pbsmmapi/season/migrations/0013_alter_pbsmmseason_date_last_api_update.py +25 -0
  89. django_pbsmmapi-1.3.4b0/pbsmmapi/season/migrations/0014_rename_pbsmmseason_season.py +19 -0
  90. django_pbsmmapi-1.3.4b0/pbsmmapi/season/migrations/0015_alter_season_id.py +23 -0
  91. django_pbsmmapi-1.3.4b0/pbsmmapi/season/migrations/0016_alter_season_images_alter_season_json_and_more.py +46 -0
  92. django_pbsmmapi-1.3.4b0/pbsmmapi/season/migrations/0017_season_provisional.py +21 -0
  93. django_pbsmmapi-1.3.4b0/pbsmmapi/season/migrations/0018_auto_increment_ordinal.py +61 -0
  94. django_pbsmmapi-1.3.4b0/pbsmmapi/season/migrations/__init__.py +0 -0
  95. django_pbsmmapi-1.3.4b0/pbsmmapi/season/models.py +152 -0
  96. django_pbsmmapi-1.3.4b0/pbsmmapi/show/__init__.py +0 -0
  97. django_pbsmmapi-1.3.4b0/pbsmmapi/show/admin.py +251 -0
  98. django_pbsmmapi-1.3.4b0/pbsmmapi/show/apps.py +6 -0
  99. django_pbsmmapi-1.3.4b0/pbsmmapi/show/forms.py +21 -0
  100. django_pbsmmapi-1.3.4b0/pbsmmapi/show/migrations/0001_initial.py +597 -0
  101. django_pbsmmapi-1.3.4b0/pbsmmapi/show/migrations/0002_remove_pbsmmshow_live_as_of_and_more.py +20 -0
  102. django_pbsmmapi-1.3.4b0/pbsmmapi/show/migrations/0003_remove_pbsmmshowasset_override_default_asset.py +16 -0
  103. django_pbsmmapi-1.3.4b0/pbsmmapi/show/migrations/0004_remove_pbsmmshow_canonical_image_type_override_and_more.py +20 -0
  104. django_pbsmmapi-1.3.4b0/pbsmmapi/show/migrations/0005_pbsmmshow_images_json_pbsmmshowasset_images_json_and_more.py +183 -0
  105. django_pbsmmapi-1.3.4b0/pbsmmapi/show/migrations/0006_delete_pbsmmshowasset.py +16 -0
  106. django_pbsmmapi-1.3.4b0/pbsmmapi/show/migrations/0006_remove_pbsmmshowasset_chapters_and_more.py +28 -0
  107. django_pbsmmapi-1.3.4b0/pbsmmapi/show/migrations/0007_remove_pbsmmshow_images_json.py +16 -0
  108. django_pbsmmapi-1.3.4b0/pbsmmapi/show/migrations/0008_alter_pbsmmshow_date_last_api_update.py +25 -0
  109. django_pbsmmapi-1.3.4b0/pbsmmapi/show/migrations/0009_rename_pbsmmshow_show.py +19 -0
  110. django_pbsmmapi-1.3.4b0/pbsmmapi/show/migrations/0010_show_franchise_show_franchise_api_id.py +36 -0
  111. django_pbsmmapi-1.3.4b0/pbsmmapi/show/migrations/0011_alter_show_id.py +23 -0
  112. django_pbsmmapi-1.3.4b0/pbsmmapi/show/migrations/0012_show_provisional_show_season_ordinal_and_more.py +90 -0
  113. django_pbsmmapi-1.3.4b0/pbsmmapi/show/migrations/0013_remove_show_season_ordinal_alter_show_ordinal_season.py +29 -0
  114. django_pbsmmapi-1.3.4b0/pbsmmapi/show/migrations/__init__.py +0 -0
  115. django_pbsmmapi-1.3.4b0/pbsmmapi/show/models.py +186 -0
  116. django_pbsmmapi-1.3.4b0/pbsmmapi/show/tasks.py +23 -0
  117. django_pbsmmapi-1.3.4b0/pbsmmapi/special/__init__.py +0 -0
  118. django_pbsmmapi-1.3.4b0/pbsmmapi/special/admin.py +143 -0
  119. django_pbsmmapi-1.3.4b0/pbsmmapi/special/apps.py +6 -0
  120. django_pbsmmapi-1.3.4b0/pbsmmapi/special/forms.py +15 -0
  121. django_pbsmmapi-1.3.4b0/pbsmmapi/special/migrations/0001_initial.py +475 -0
  122. django_pbsmmapi-1.3.4b0/pbsmmapi/special/migrations/0002_auto_20190430_1853.py +27 -0
  123. django_pbsmmapi-1.3.4b0/pbsmmapi/special/migrations/0003_pbsmmspecial_show_api_id.py +22 -0
  124. django_pbsmmapi-1.3.4b0/pbsmmapi/special/migrations/0004_auto_20190430_1949.py +22 -0
  125. django_pbsmmapi-1.3.4b0/pbsmmapi/special/migrations/0005_remove_pbsmmspecial_live_as_of_and_more.py +20 -0
  126. django_pbsmmapi-1.3.4b0/pbsmmapi/special/migrations/0006_remove_pbsmmspecialasset_override_default_asset.py +16 -0
  127. django_pbsmmapi-1.3.4b0/pbsmmapi/special/migrations/0007_remove_pbsmmspecialasset_canonical_image_type_override.py +16 -0
  128. django_pbsmmapi-1.3.4b0/pbsmmapi/special/migrations/0008_pbsmmspecialasset_images_json_and_more.py +129 -0
  129. django_pbsmmapi-1.3.4b0/pbsmmapi/special/migrations/0009_delete_pbsmmspecialasset.py +16 -0
  130. django_pbsmmapi-1.3.4b0/pbsmmapi/special/migrations/0009_remove_pbsmmspecialasset_chapters_and_more.py +28 -0
  131. django_pbsmmapi-1.3.4b0/pbsmmapi/special/migrations/0010_alter_pbsmmspecial_date_last_api_update.py +25 -0
  132. django_pbsmmapi-1.3.4b0/pbsmmapi/special/migrations/0011_rename_pbsmmspecial_special.py +18 -0
  133. django_pbsmmapi-1.3.4b0/pbsmmapi/special/migrations/0012_alter_special_id.py +23 -0
  134. django_pbsmmapi-1.3.4b0/pbsmmapi/special/migrations/0013_alter_special_json_alter_special_links.py +36 -0
  135. django_pbsmmapi-1.3.4b0/pbsmmapi/special/migrations/0014_special_provisional.py +21 -0
  136. django_pbsmmapi-1.3.4b0/pbsmmapi/special/migrations/__init__.py +0 -0
  137. django_pbsmmapi-1.3.4b0/pbsmmapi/special/models.py +88 -0
  138. django_pbsmmapi-1.3.4b0/pbsmmapi/test/__init__.py +0 -0
  139. django_pbsmmapi-1.3.4b0/pbsmmapi/test/settings.py +151 -0
  140. django_pbsmmapi-1.3.4b0/pbsmmapi/test/test_show_ingest.py +135 -0
  141. django_pbsmmapi-1.3.4b0/pbsmmapi/test/url_map.py +3194 -0
  142. django_pbsmmapi-1.3.4b0/pbsmmapi/test/urls.py +19 -0
  143. django_pbsmmapi-1.3.4b0/pyproject.toml +72 -0
@@ -0,0 +1,72 @@
1
+ *OBSOLETE*
2
+
3
+ # Compiled source #
4
+ ###################
5
+ *.pyc
6
+
7
+ # Packages #
8
+ ############
9
+ *.7z
10
+ *.dmg
11
+ *.gz
12
+ *.iso
13
+ *.jar
14
+ *.rar
15
+ *.tar
16
+ *.zip
17
+
18
+ # Logs and databases #
19
+ ######################
20
+ *.log
21
+ *.sql
22
+ *.sqlite
23
+ *.db
24
+
25
+ # OS generated files #
26
+ ######################
27
+ .DS_Store
28
+
29
+
30
+ # media #
31
+ #########
32
+ media/
33
+ media/*
34
+
35
+ # backup #
36
+ ##########
37
+ __BACKUP__/
38
+ __BACKUP__/*
39
+
40
+ # data #
41
+ ########
42
+ __DATA__/
43
+ __DATA__/*
44
+
45
+ # media #
46
+ #########
47
+ static/
48
+ static/*
49
+
50
+ # Redirection #
51
+ ############
52
+
53
+ # front end tooling #
54
+ **/node_modules/**
55
+ **/.sass-cache/**
56
+ *.css.map
57
+
58
+ # whoosh
59
+ whoosh_index/
60
+
61
+ Pipfile
62
+ Pipfile.lock
63
+
64
+ *.egg-info/
65
+
66
+ .coverage
67
+ .python-version
68
+ .tox/
69
+
70
+ build/
71
+ django_pbsmmapi.egg-info/
72
+ dist
@@ -0,0 +1,20 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 WGBH Educational Foundation
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
@@ -0,0 +1,83 @@
1
+ Metadata-Version: 2.4
2
+ Name: django-pbsmmapi
3
+ Version: 1.3.4b0
4
+ Summary: Django models that import content from the PBS MediaManager API
5
+ Author: Bob Donahue
6
+ License-Expression: MIT
7
+ License-File: LICENSE
8
+ Classifier: Development Status :: 5 - Production/Stable
9
+ Classifier: Environment :: Web Environment
10
+ Classifier: Framework :: Django
11
+ Classifier: Framework :: Django :: 4.0
12
+ Classifier: Framework :: Django :: 4.1
13
+ Classifier: Framework :: Django :: 4.2
14
+ Classifier: Framework :: Django :: 5.0
15
+ Classifier: Framework :: Django :: 5.1
16
+ Classifier: Framework :: Django :: 5.2
17
+ Classifier: Intended Audience :: Developers
18
+ Classifier: License :: OSI Approved :: MIT License
19
+ Classifier: Natural Language :: English
20
+ Classifier: Operating System :: OS Independent
21
+ Classifier: Topic :: Internet :: WWW/HTTP
22
+ Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
23
+ Requires-Python: <4.0,>=3.10
24
+ Requires-Dist: django>=4.0
25
+ Requires-Dist: huey>=2.5.3
26
+ Requires-Dist: nltk>=3.9
27
+ Requires-Dist: pycaption>=2.2.16
28
+ Requires-Dist: python-dateutil
29
+ Requires-Dist: pytz
30
+ Requires-Dist: requests
31
+ Description-Content-Type: text/markdown
32
+
33
+ # django-pbsmmapi
34
+
35
+ Code to model PBS MediaManager objects; scripts to ingest data into those models.
36
+
37
+ ## Introduction
38
+
39
+ This is a Django app to allow Django-based projects to work with the PBS MediaManager API. It is not expected to be a COMPLETE interface to the entirety of the PBS MediaManager; however it should allow access to all of the primary content object types.
40
+
41
+ In addition to Django, [huey](https://huey.readthedocs.io/en/latest/) is used for running background ingestion tasks.
42
+
43
+ ## Quick start
44
+
45
+ 1. Add the pbsmmapi apps to your INSTALLED_APPS setting:
46
+
47
+ ```python
48
+ INSTALLED_APPS = [
49
+ ...
50
+ 'pbsmmapi',
51
+ 'pbsmmapi.episode',
52
+ 'pbsmmapi.season',
53
+ 'pbsmmapi.show',
54
+ 'pbsmmapi.special',
55
+ 'pbsmmapi.franchise',
56
+ 'pbsmmapi.changelog',
57
+ ]
58
+ ```
59
+
60
+ 2. You ALSO need to have PBS Media Manager credentials - an API KEY and a SECRET KEY. These also go into the `settings.py` file of your project:
61
+
62
+ ```python
63
+ PBSMM_API_ID = os.environ["PBSMM_API_ID"]
64
+ PBSMM_API_SECRET = os.environ["PBSMM_API_SECRET"]
65
+ ```
66
+
67
+ It's not a good idea to commit these in plain text. Set them as environment variables (as suggested above) or using some other secret management tool.
68
+
69
+ 3. To ingest shows and/or franchises automatically, configure `PBSMM_SHOW_SLUGS` and/or `PBSMM_FRANCHISE_SLUGS`:
70
+
71
+ ```
72
+ PBSMM_SHOW_SLUGS = [
73
+ "antiques-roadshow",
74
+ ]
75
+
76
+ PBSMM_FRANCHISE_SLUGS = [
77
+ "masterpiece",
78
+ ]
79
+ ```
80
+
81
+ Huey will attempt to scrape all Show and/or Franchise data, including Specials, Seasons, Episodes, and Assets. The changelog endpoint will also be scraped.
82
+
83
+ Once a complete ingest has finished, changelog data is used to ingest updated and newly added objects.
@@ -0,0 +1,51 @@
1
+ # django-pbsmmapi
2
+
3
+ Code to model PBS MediaManager objects; scripts to ingest data into those models.
4
+
5
+ ## Introduction
6
+
7
+ This is a Django app to allow Django-based projects to work with the PBS MediaManager API. It is not expected to be a COMPLETE interface to the entirety of the PBS MediaManager; however it should allow access to all of the primary content object types.
8
+
9
+ In addition to Django, [huey](https://huey.readthedocs.io/en/latest/) is used for running background ingestion tasks.
10
+
11
+ ## Quick start
12
+
13
+ 1. Add the pbsmmapi apps to your INSTALLED_APPS setting:
14
+
15
+ ```python
16
+ INSTALLED_APPS = [
17
+ ...
18
+ 'pbsmmapi',
19
+ 'pbsmmapi.episode',
20
+ 'pbsmmapi.season',
21
+ 'pbsmmapi.show',
22
+ 'pbsmmapi.special',
23
+ 'pbsmmapi.franchise',
24
+ 'pbsmmapi.changelog',
25
+ ]
26
+ ```
27
+
28
+ 2. You ALSO need to have PBS Media Manager credentials - an API KEY and a SECRET KEY. These also go into the `settings.py` file of your project:
29
+
30
+ ```python
31
+ PBSMM_API_ID = os.environ["PBSMM_API_ID"]
32
+ PBSMM_API_SECRET = os.environ["PBSMM_API_SECRET"]
33
+ ```
34
+
35
+ It's not a good idea to commit these in plain text. Set them as environment variables (as suggested above) or using some other secret management tool.
36
+
37
+ 3. To ingest shows and/or franchises automatically, configure `PBSMM_SHOW_SLUGS` and/or `PBSMM_FRANCHISE_SLUGS`:
38
+
39
+ ```
40
+ PBSMM_SHOW_SLUGS = [
41
+ "antiques-roadshow",
42
+ ]
43
+
44
+ PBSMM_FRANCHISE_SLUGS = [
45
+ "masterpiece",
46
+ ]
47
+ ```
48
+
49
+ Huey will attempt to scrape all Show and/or Franchise data, including Specials, Seasons, Episodes, and Assets. The changelog endpoint will also be scraped.
50
+
51
+ Once a complete ingest has finished, changelog data is used to ingest updated and newly added objects.
@@ -0,0 +1 @@
1
+ __version__ = "1.3.4b0"
File without changes
@@ -0,0 +1,64 @@
1
+ from django.contrib import admin
2
+ from django.contrib.admin import site
3
+ from django.utils.safestring import mark_safe
4
+
5
+ # This removed the delete function from the Admin action dropdown.
6
+ # You can 're-add' it, if necessary, by explicitly adding it to the
7
+ # actions parameter for a given ModelAdmin instance.
8
+ site.disable_action("delete_selected")
9
+
10
+
11
+ class PBSMMAbstractAdmin(admin.ModelAdmin):
12
+ actions = [
13
+ "force_reingest",
14
+ ]
15
+ search_fields = [
16
+ "title",
17
+ ]
18
+
19
+ def force_reingest(self, request, queryset):
20
+ # queryset is the list of Asset items that were selected.
21
+ for item in queryset:
22
+ item.ingest_on_save = True
23
+ # HOW DO I FIND OUT IF THE save() was successful?
24
+ item.save()
25
+
26
+ force_reingest.short_description = "Reingest selected items."
27
+
28
+ def assemble_asset_table(self, obj):
29
+ asset_list = obj.assets.all()
30
+ out = get_abstract_asset_table(asset_list)
31
+ return mark_safe(out)
32
+
33
+ assemble_asset_table.short_description = "Assets"
34
+
35
+ class Meta:
36
+ abstract = True
37
+
38
+
39
+ def get_abstract_asset_table(object_list):
40
+ url = "/admin/asset/asset"
41
+ if len(object_list) < 1:
42
+ return "(No assets)"
43
+ out = '<table width="100%" border=2>'
44
+ out += (
45
+ '\n<tr style="background-color:'
46
+ ' #999;l"><th>Title</th><th>Type</th>'
47
+ "<th>Duration</th><th>Avail?</th><th>API</th></tr>"
48
+ )
49
+ for item in object_list:
50
+ row_color = "#ffffff;"
51
+
52
+ out += '\n<tr style="background-color:%s">' % row_color
53
+ out += '\n\t<td><a href="%s/%d/change/" target="_new">%s</a></td>' % (
54
+ url,
55
+ item.id,
56
+ item.title,
57
+ )
58
+ out += "\n\t<td>%s</td>" % item.asset_type
59
+ out += "\n\t<td>%s</td>" % item.formatted_duration
60
+ out += "\n\t<td>%s</td>" % item.asset_publicly_available()
61
+ out += '\n\t<td><a href="%s" target="_new">API</a></td>' % item.api_endpoint
62
+ out += "\n</tr>"
63
+ out += "\n</table>"
64
+ return out
@@ -0,0 +1,26 @@
1
+ from datetime import datetime
2
+
3
+ import pytz
4
+
5
+
6
+ def fix_non_aware_datetime(obj):
7
+ """
8
+ Ugh - for SOME REASON some of the DateTime values returned by the PBS MM
9
+ API are NOT time zone aware. SO - fudge them by adding 00:00:00 UTC (if
10
+ even a time is not provided) or assume the time is UTC.
11
+ """
12
+ if obj is None:
13
+ return None
14
+ if ":" not in obj: # oops no time
15
+ obj += " 00:00:00"
16
+ if "+" not in obj: # no time zone - use UTC
17
+ if "Z" not in obj:
18
+ obj += "+00:00"
19
+ return obj
20
+
21
+
22
+ def time_zone_aware_now():
23
+ """
24
+ This just sends back a time zone aware "now()" with UTC as the time zone.
25
+ """
26
+ return datetime.now(pytz.utc)