Skip to content

Commit 11214dc

Browse files
authored
Merge pull request #47 from trms/cablecast-cdn-thumbnails
Cablecast cdn thumbnails
2 parents 80daf6d + de1311a commit 11214dc

46 files changed

Lines changed: 13635 additions & 317 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/tests.yml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [ master, main, develop ]
6+
pull_request:
7+
branches: [ master, main, develop ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
php-version: ['7.4', '8.0', '8.1', '8.2']
17+
wordpress-version: ['6.2', '6.4', 'latest']
18+
19+
services:
20+
mysql:
21+
image: mysql:5.7
22+
env:
23+
MYSQL_ROOT_PASSWORD: root
24+
MYSQL_DATABASE: wordpress_test
25+
ports:
26+
- 3306:3306
27+
options: >-
28+
--health-cmd="mysqladmin ping"
29+
--health-interval=10s
30+
--health-timeout=5s
31+
--health-retries=3
32+
33+
steps:
34+
- name: Checkout code
35+
uses: actions/checkout@v4
36+
37+
- name: Setup PHP
38+
uses: shivammathur/setup-php@v2
39+
with:
40+
php-version: ${{ matrix.php-version }}
41+
extensions: mbstring, intl, mysqli
42+
coverage: none
43+
44+
- name: Get Composer cache directory
45+
id: composer-cache
46+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
47+
48+
- name: Cache Composer dependencies
49+
uses: actions/cache@v3
50+
with:
51+
path: ${{ steps.composer-cache.outputs.dir }}
52+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
53+
restore-keys: ${{ runner.os }}-composer-
54+
55+
- name: Install Composer dependencies
56+
run: composer install --prefer-dist --no-progress
57+
58+
- name: Install subversion
59+
run: sudo apt-get update && sudo apt-get install -y subversion
60+
61+
- name: Install WordPress test suite
62+
run: |
63+
bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1 ${{ matrix.wordpress-version }} true
64+
env:
65+
WP_TESTS_DIR: /tmp/wordpress-tests-lib
66+
WP_CORE_DIR: /tmp/wordpress
67+
68+
- name: Run PHPUnit tests
69+
run: composer test
70+
env:
71+
WP_TESTS_DIR: /tmp/wordpress-tests-lib
72+
WP_CORE_DIR: /tmp/wordpress
73+
74+
# Code style check (optional)
75+
phpcs:
76+
runs-on: ubuntu-latest
77+
78+
steps:
79+
- name: Checkout code
80+
uses: actions/checkout@v4
81+
82+
- name: Setup PHP
83+
uses: shivammathur/setup-php@v2
84+
with:
85+
php-version: '8.1'
86+
tools: phpcs
87+
88+
- name: Check PHP syntax errors
89+
run: find . -name "*.php" -not -path "./vendor/*" -exec php -l {} \;

.gitignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Composer
2+
/vendor/
3+
composer.lock
4+
5+
# PHPUnit
6+
.phpunit.result.cache
7+
/coverage/
8+
9+
# IDE
10+
.idea/
11+
.vscode/
12+
*.swp
13+
*.swo
14+
15+
# OS
16+
.DS_Store
17+
Thumbs.db
18+
19+
# WordPress test files (local)
20+
/tmp/
21+
22+
# Logs
23+
*.log

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,17 @@ The plugin provides a function `cablecast_get_schedules($channel_id, $date_start
9595
|`channel_post_id`| |
9696
|`schedule_item_id`| |
9797

98+
**Important: Timezone Handling**
99+
100+
The `cablecast_get_schedules()` function automatically handles timezone conversion. Schedule times are stored in UTC in the database and converted to your WordPress site's configured timezone (Settings > General > Timezone) when retrieved.
101+
102+
Always use `cablecast_get_schedules()` to query schedules rather than direct database queries. This ensures:
103+
- Dates you pass in are interpreted in your site's timezone
104+
- Returned `run_date_time` values are in your site's timezone
105+
- Correct schedule items are returned for the requested date range
106+
107+
Make sure your WordPress timezone is configured correctly in Settings > General for accurate schedule display.
108+
98109
### How do I show the live stream for a channel?
99110
The plugin sets a custom meta property of `cablecast_channel_live_embed_code` to the channel for the embed code to watch the live stream. If this property isn't set it's likely your Cablecast isn't configured correctly, or you don't have a live streaming server.
100111

TODO.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# wp-cablecast Plugin TODO
2+
3+
## Future Data Sources
4+
5+
### Show Agendas
6+
7+
The theme template `show-agenda.php` supports displaying PDF agendas for shows. Currently this is a placeholder template that needs a data source.
8+
9+
**Required implementation:**
10+
- Add meta field `cablecast_show_agenda_url` to store the URL of the agenda PDF
11+
- Option A: Sync from Cablecast API if agenda attachments are available
12+
- Option B: Allow manual entry via WordPress admin
13+
- Option C: Look for agenda in Cablecast show attachments during sync
14+
15+
**Meta field name:** `cablecast_show_agenda_url`
16+
**Expected value:** Full URL to PDF file (string)
17+
18+
### Show Chapters
19+
20+
The theme template `show-chapters.php` supports displaying chapter markers/timestamps for shows. Currently this is a placeholder template.
21+
22+
**Required implementation:**
23+
- Add meta field `cablecast_show_chapters` to store chapter data
24+
- Data format: Array of associative arrays with `timestamp` and `title` keys
25+
- Option A: Sync from Cablecast API if chapter data is available
26+
- Option B: Allow manual entry via WordPress admin
27+
- Option C: Parse from video metadata during sync
28+
29+
**Meta field name:** `cablecast_show_chapters`
30+
**Expected value:** Serialized array
31+
```php
32+
[
33+
['timestamp' => '00:00:00', 'title' => 'Introduction'],
34+
['timestamp' => '00:05:30', 'title' => 'Main Topic'],
35+
['timestamp' => '00:15:00', 'title' => 'Q&A'],
36+
]
37+
```
38+
39+
## Notes
40+
41+
- Both features require corresponding changes in `includes/sync.php` if sourcing from Cablecast API
42+
- Theme templates are ready to consume this data once meta fields are populated

0 commit comments

Comments
 (0)