1
0
forked from HPR/hpr-tools

Updates from previous repo

FAQ/FAQ.mkd, FAQ/Makefile: this version of the FAQ is now out of date
    and probably should be deleted.

InternetArchive/repair_item: script to upload missing shows after tie
    out errors during the normal upload; still under development.

InternetArchive/update_state: script to update show state in the
    'reservations' table in the database. Uses the CMS interface.

Link_Checker/scan_links: under development. Not currently usable.

Miscellaneous/fix_tags: audio metadata manipulation script. Recently
    added to this repo for convenience. Updates for 'experimental::try',
    the official Perl try/catch.

PostgreSQL_Database/add_hosts_to_show, PostgreSQL_Database/hpr_schema_2.pgsql,
    PostgreSQL_Database/nuke_n_pave.sh: an old experimental Pg database
    to take over from the previous MySQL version (from before 2023).
    Kept for reference; never implemented.
This commit is contained in:
Dave Morriss
2024-06-14 16:00:04 +01:00
parent 38abbcdd39
commit 50edeccc88
12 changed files with 1874 additions and 146 deletions

View File

@@ -535,7 +535,7 @@ sub find_hosts {
# DESCRIPTION: Places all the hosts associated with the show into an array
# then compares it with the @$hosts array such that what is left
# is all the hosts that do not match hosts linked to the show.
# Of cxourse, if any of the hosts given as options are not exact
# Of course, if any of the hosts given as options are not exact
# matches with the names from the database (they are regexes
# perhaps) they'll be regarded as different. We have to do
# further processing of what's returned from querying the

View File

@@ -22,6 +22,19 @@
* 'episodes_id' seems stupid.
*
* ------------------------------------------------------------------------------
* Tables:
*
* comments
* episodes
* episodes_hosts_xref
* episodes_series_xref
* episodes_tags_xref
* hosts
* licenses
* series
* tags
* assets
*
*/
/* ------------------------------------------------------------------------------
@@ -63,13 +76,15 @@ DROP FUNCTION IF EXISTS comment_changed();
-- }}}
-- \/\/ licenses \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
-- +----------+
-- | licenses |
-- +----------+
-- {{{
/* ------------------------------------------------------------------------------
* Table 'licenses' - licenses relating to episodes (needed because 'episodes'
* and hosts' reference it)
* and 'hosts' reference it)
*
* license_id primary key, the licence number
* short_name brief name of CC licence
@@ -123,7 +138,9 @@ ALTER FUNCTION id_in_licenses(sname varchar)
-- }}}
-- \/\/ episodes \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
-- +----------+
-- | episodes |
-- +----------+
-- {{{
@@ -203,6 +220,65 @@ ALTER FUNCTION id_in_episodes(ekey varchar)
-- }}}
-- +-----------+
-- | episodes2 |
-- +-----------+
-- {{{
/* ------------------------------------------------------------------------------
* Table 'episodes2' - TWAT and HPR shows
*
* show_id zero for a TwaT show, 1 for an HPR show
* episode_id episode number in the range of show_id values
* release_date date the episode was released
* title title of the episode
* summary summary of the episode content
* notes the show notes (as an HTML fragment)
* explicit a Boolean; true for explicit, false for otherwise
* license the licence which the show is under (US spelling)
* duration the duration (time) of the audio
* downloads number of downloads
* archived a Boolean; true if the episode has been uploaded to the IA
* archive_date date the episode was archived
* IA_URL URL to the episode on archive.org
* journal a journal of actions performed on this episode
*
* ------------------------------------------------------------------------------ */
-- CREATE TYPE episode_status AS ENUM ('reserved', 'processing', 'posted');
DROP TABLE IF EXISTS episodes2 CASCADE;
CREATE TABLE episodes2 (
show_id smallint NOT NULL DEFAULT 1
CHECK (show_id = 0 OR show_id = 1),
episode_id smallint NOT NULL,
release_date date NOT NULL,
title varchar(128) NOT NULL,
summary varchar(128),
notes text NOT NULL,
explicit boolean NOT NULL DEFAULT TRUE,
license integer NOT NULL DEFAULT id_in_licenses('CC-BY-SA')
REFERENCES licenses (license_id),
duration interval NOT NULL DEFAULT '00:00:00',
downloads integer NOT NULL DEFAULT 0,
archived boolean NOT NULL DEFAULT FALSE,
archive_date date,
IA_URL text,
status episode_status,
journal text,
PRIMARY KEY (show_id, episode_id)
);
ALTER TABLE episodes2
OWNER TO hpradmin;
CREATE INDEX episode2_release_date_idx
ON episodes2
USING btree
(release_date);
-- }}}
-- \/\/ hosts /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
-- {{{

View File

@@ -6,6 +6,16 @@
# hosts by adding the missing hosts.
#
#
# Check that the ensuing destruction is really meant!
#
echo "** Warning** This script will DELETE the PostgreSQL database 'HPR2'"
read -r -p "Are you sure? [y/N] " ans
if [[ -z $ans || ${ans^^} = 'N' ]]; then
echo "Aborting"
exit
fi
#
# Directories
#