generated from nhcarrigan/template
This commit is contained in:
parent
e33df16e43
commit
00dc40ba47
36
books.sh
Executable file
36
books.sh
Executable file
@ -0,0 +1,36 @@
|
|||||||
|
IFS=$'\n'
|
||||||
|
|
||||||
|
# Initialize an empty string to hold the list of books in JSON-like format
|
||||||
|
books=""
|
||||||
|
filecount=$(find /home/naomi/cloud/Books -type f | wc -l)
|
||||||
|
echo "Found $filecount files."
|
||||||
|
current=0
|
||||||
|
|
||||||
|
# Loop over each file found by find
|
||||||
|
for file in $(find /home/naomi/cloud/Books -type f -print0 | tr '\0' '\n'); do
|
||||||
|
current=$((current + 1))
|
||||||
|
echo -ne "Processing $current/$filecount\r"
|
||||||
|
title=$(exiftool "$file" | grep "^Title\s*:" | cut -d ":" -f 2 | sed -e 's/^[[:space:]]*//')
|
||||||
|
author=$(exiftool "$file" | grep "^Creator\s*:" | cut -d ":" -f 2 | sed -e 's/^[[:space:]]*//')
|
||||||
|
|
||||||
|
if [ -z "$title" ]; then
|
||||||
|
# remove .mp3 from the title
|
||||||
|
title=$(basename "$file" | sed -e 's/\.*//g')
|
||||||
|
fi
|
||||||
|
if [ -z "$author" ]; then
|
||||||
|
author=$(exiftool "$file" | grep "^Author\s*:" | cut -d ":" -f 2 | sed -e 's/^[[:space:]]*//')
|
||||||
|
fi
|
||||||
|
if [ -z "$author" ]; then
|
||||||
|
author="Unknown Author"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# use jq to add the book to the list
|
||||||
|
books="$books$(jq -n --arg title "$title" --arg author "$author" '{title: $title, author: $author}'),"
|
||||||
|
done
|
||||||
|
|
||||||
|
# Remove trailing comma and add square brackets to complete the list
|
||||||
|
books="[${books%,}]"
|
||||||
|
|
||||||
|
# Write to ./books/books.json
|
||||||
|
echo "$books" > ./books/books.json
|
||||||
|
echo -ne "Done!\r"
|
508
books/books.json
Normal file
508
books/books.json
Normal file
@ -0,0 +1,508 @@
|
|||||||
|
[{
|
||||||
|
"title": "Traveler",
|
||||||
|
"author": "Weisman, Greg (Gregory David), 1963- author"
|
||||||
|
},{
|
||||||
|
"title": "Books of The Elder Scrolls V",
|
||||||
|
"author": "Bethesda Softworks"
|
||||||
|
},{
|
||||||
|
"title": "Flashpoint",
|
||||||
|
"author": "Christie Golden"
|
||||||
|
},{
|
||||||
|
"title": "The Eternal Ice",
|
||||||
|
"author": "Jeff Grubb"
|
||||||
|
},{
|
||||||
|
"title": "Dissension",
|
||||||
|
"author": "Cory Herndon"
|
||||||
|
},{
|
||||||
|
"title": "Siege of Darkness",
|
||||||
|
"author": "R. A. Salvatore"
|
||||||
|
},{
|
||||||
|
"title": "StarCraft",
|
||||||
|
"author": "Tracy Hickman"
|
||||||
|
},{
|
||||||
|
"title": "The Last Guardian",
|
||||||
|
"author": "Jeff Grubb"
|
||||||
|
},{
|
||||||
|
"title": "Two friends and other nineteenth-century lesbian stories by American women writers",
|
||||||
|
"author": "Koppelman, Susan"
|
||||||
|
},{
|
||||||
|
"title": "Starlight Enclave",
|
||||||
|
"author": "R. A. Salvatore"
|
||||||
|
},{
|
||||||
|
"title": "Hazezon",
|
||||||
|
"author": "Magic The Gathering"
|
||||||
|
},{
|
||||||
|
"title": "Masquerade Cycle • Book II • Nemesis",
|
||||||
|
"author": "Paul B. Thompson"
|
||||||
|
},{
|
||||||
|
"title": "IFYALO layout.indd",
|
||||||
|
"author": "Adobe InDesign CC 2015 (Macintosh)"
|
||||||
|
},{
|
||||||
|
"title": "The Spine of the World",
|
||||||
|
"author": "R. A. Salvatore"
|
||||||
|
},{
|
||||||
|
"title": "Hero",
|
||||||
|
"author": "R.A. Salvatore"
|
||||||
|
},{
|
||||||
|
"title": "The Dawn of the Future",
|
||||||
|
"author": "Jun Eishima"
|
||||||
|
},{
|
||||||
|
"title": "Starless Night",
|
||||||
|
"author": "R. A. Salvatore"
|
||||||
|
},{
|
||||||
|
"title": "Fragments of Horror",
|
||||||
|
"author": "Junji Ito"
|
||||||
|
},{
|
||||||
|
"title": "War Crimes",
|
||||||
|
"author": "Christie Golden"
|
||||||
|
},{
|
||||||
|
"title": "StarCraft",
|
||||||
|
"author": "Micky Neilson"
|
||||||
|
},{
|
||||||
|
"title": "Likewise ",
|
||||||
|
"author": "Schrag, Ariel"
|
||||||
|
},{
|
||||||
|
"title": "Influence",
|
||||||
|
"author": "Robert B. Cialdini Ph.D."
|
||||||
|
},{
|
||||||
|
"title": "Magic The Gathering - Artifact Cycle 01 - The Brothers' War",
|
||||||
|
"author": "Magic The Gathering"
|
||||||
|
},{
|
||||||
|
"title": "StarCraft",
|
||||||
|
"author": "Jeff Grubb"
|
||||||
|
},{
|
||||||
|
"title": "Thrall Twilight of the Aspects",
|
||||||
|
"author": "Golden, Christie"
|
||||||
|
},{
|
||||||
|
"title": "Illidan",
|
||||||
|
"author": "William King"
|
||||||
|
},{
|
||||||
|
"title": "Deltora Quest #2",
|
||||||
|
"author": "Emily Rodda"
|
||||||
|
},{
|
||||||
|
"title": "Cycle of Hatred",
|
||||||
|
"author": "Keith R.A. DeCandido"
|
||||||
|
},{
|
||||||
|
"title": "Tomorrow Wendy ",
|
||||||
|
"author": "Stoehr, Shelley"
|
||||||
|
},{
|
||||||
|
"title": "Invasion",
|
||||||
|
"author": "J. Robert King"
|
||||||
|
},{
|
||||||
|
"title": "Hello Cruel World",
|
||||||
|
"author": "Kate Bornstein"
|
||||||
|
},{
|
||||||
|
"title": "The Lone Drow",
|
||||||
|
"author": "R. A. Salvatore"
|
||||||
|
},{
|
||||||
|
"title": "The Halfling's Gem",
|
||||||
|
"author": "R. A. Salvatore"
|
||||||
|
},{
|
||||||
|
"title": "Cinder Ella",
|
||||||
|
"author": "S.T. Lynn"
|
||||||
|
},{
|
||||||
|
"title": "Devils' Due",
|
||||||
|
"author": "Christie Golden"
|
||||||
|
},{
|
||||||
|
"title": "World of Warcraft Chronicle Volume 3",
|
||||||
|
"author": "BLIZZARD ENTERTAINMENT"
|
||||||
|
},{
|
||||||
|
"title": "The Ghost King",
|
||||||
|
"author": "R. A. Salvatore"
|
||||||
|
},{
|
||||||
|
"title": "transition 01 The Orc King",
|
||||||
|
"author": "R .A. Salvatore"
|
||||||
|
},{
|
||||||
|
"title": "The Infernal City",
|
||||||
|
"author": "Greg Keyes"
|
||||||
|
},{
|
||||||
|
"title": "Timeless",
|
||||||
|
"author": "R. A. Salvatore"
|
||||||
|
},{
|
||||||
|
"title": "Assassin's blade",
|
||||||
|
"author": "McGough, Scott"
|
||||||
|
},{
|
||||||
|
"title": "Neverwinter",
|
||||||
|
"author": "R. A. Salvatore"
|
||||||
|
},{
|
||||||
|
"title": "The Legacy",
|
||||||
|
"author": "R. A. Salvatore"
|
||||||
|
},{
|
||||||
|
"title": "A Novel",
|
||||||
|
"author": "Juno Dawson"
|
||||||
|
},{
|
||||||
|
"title": "Onslaught (mtg-1)",
|
||||||
|
"author": "J. Robert King"
|
||||||
|
},{
|
||||||
|
"title": "Jedit (mtg-2)",
|
||||||
|
"author": "Clayton Emery"
|
||||||
|
},{
|
||||||
|
"title": "Apocalypse",
|
||||||
|
"author": "J. Robert King"
|
||||||
|
},{
|
||||||
|
"title": "T03. The Shining Blade",
|
||||||
|
"author": "Madeleine Roux"
|
||||||
|
},{
|
||||||
|
"title": "Andromeda",
|
||||||
|
"author": "Jason M. Hough"
|
||||||
|
},{
|
||||||
|
"title": "Jaina Proudmoore",
|
||||||
|
"author": "Christie Golden"
|
||||||
|
},{
|
||||||
|
"title": "The Legend of Drizzt: The Collected Stories",
|
||||||
|
"author": "R.A. Salvatore"
|
||||||
|
},{
|
||||||
|
"title": "StarCraft",
|
||||||
|
"author": "Gabriel Mesta"
|
||||||
|
},{
|
||||||
|
"title": "The Complete Asimov by Isaac Asimov",
|
||||||
|
"author": "Isaac Asimov"
|
||||||
|
},{
|
||||||
|
"title": "Deserter",
|
||||||
|
"author": "Junji Ito"
|
||||||
|
},{
|
||||||
|
"title": "The Thran",
|
||||||
|
"author": "J. Robert King"
|
||||||
|
},{
|
||||||
|
"title": "Neo Cyberpunk",
|
||||||
|
"author": "Matthew A. Goodwin, Anna Mocikat, Marlin Seigman, Elias J. Hurst, Jon Richter, A.W. Wang, Matt Adcock, Nik Whittaker, Mark Everglade, Tanweer Dar, Eric Malikyte, James L. Graetz, Benjamin Fisher-Merritt, Luke Hancock, PATRICK TILLETT"
|
||||||
|
},{
|
||||||
|
"title": "The Ghost in the Shell",
|
||||||
|
"author": "Tow Ubukata"
|
||||||
|
},{
|
||||||
|
"title": "Unbroken",
|
||||||
|
"author": "Micky Neilson"
|
||||||
|
},{
|
||||||
|
"title": "The complete strangers in paradise. volume three, part five",
|
||||||
|
"author": "Moore, Terry, 1954-"
|
||||||
|
},{
|
||||||
|
"title": "Deltora Quest #4",
|
||||||
|
"author": "Emily Rodda"
|
||||||
|
},{
|
||||||
|
"title": "The Darksteel Eye",
|
||||||
|
"author": "Jess Lebow"
|
||||||
|
},{
|
||||||
|
"title": "Morningtide",
|
||||||
|
"author": "Cory Herndon"
|
||||||
|
},{
|
||||||
|
"title": "The Well of Eternity",
|
||||||
|
"author": "Richard A. Knaak"
|
||||||
|
},{
|
||||||
|
"title": "The Silent Blade",
|
||||||
|
"author": "R.A. Salvatore"
|
||||||
|
},{
|
||||||
|
"title": "Homeland",
|
||||||
|
"author": "R. A. Salvatore"
|
||||||
|
},{
|
||||||
|
"title": "Charon's Claw",
|
||||||
|
"author": "R. A. Salvatore"
|
||||||
|
},{
|
||||||
|
"title": "Sea of Swords",
|
||||||
|
"author": "R. A. Salvatore"
|
||||||
|
},{
|
||||||
|
"title": "Final Fantasy VII Remake",
|
||||||
|
"author": "Nojima, Kazushige"
|
||||||
|
},{
|
||||||
|
"title": "World of Warcraft Chronicle Volume 2 (World of Warcraft",
|
||||||
|
"author": "Blizzard"
|
||||||
|
},{
|
||||||
|
"title": "Warcraft - Warcraft 01",
|
||||||
|
"author": "Day of the Dragon # Richard A. Knaak"
|
||||||
|
},{
|
||||||
|
"title": "Light From Uncommon Stars",
|
||||||
|
"author": "Ryka Aoki"
|
||||||
|
},{
|
||||||
|
"title": "Planeshift",
|
||||||
|
"author": "J. Robert King"
|
||||||
|
},{
|
||||||
|
"title": "Planar Chaos",
|
||||||
|
"author": "Timothy Sanders"
|
||||||
|
},{
|
||||||
|
"title": "Magic The Gathering - Invasion Cycle Book 02 - Planeshift",
|
||||||
|
"author": "Magic The Gathering"
|
||||||
|
},{
|
||||||
|
"title": "The Crystal Shard",
|
||||||
|
"author": "R.A. Salvatore"
|
||||||
|
},{
|
||||||
|
"title": "Magic The Gathering - Artifact Cycle 03 - Time Streams",
|
||||||
|
"author": "Magic The Gathering"
|
||||||
|
},{
|
||||||
|
"title": "The Thousand Orcs",
|
||||||
|
"author": "R. A. Salvatore"
|
||||||
|
},{
|
||||||
|
"title": "Final Fantasy - The Spirits Within",
|
||||||
|
"author": "Dean Wesley Smith"
|
||||||
|
},{
|
||||||
|
"title": "Outlaw, Champions of Kamigawa",
|
||||||
|
"author": "Scott Mcgough"
|
||||||
|
},{
|
||||||
|
"title": "Legions",
|
||||||
|
"author": "King, J. Robert"
|
||||||
|
},{
|
||||||
|
"title": "War of the Scaleborn",
|
||||||
|
"author": "Courtney Alameda"
|
||||||
|
},{
|
||||||
|
"title": "Guildpact",
|
||||||
|
"author": "Cory Herndon"
|
||||||
|
},{
|
||||||
|
"title": "Relentless",
|
||||||
|
"author": "R. A. Salvatore"
|
||||||
|
},{
|
||||||
|
"title": "StarCraft",
|
||||||
|
"author": "Timothy Zahn"
|
||||||
|
},{
|
||||||
|
"title": "The Last Threshold",
|
||||||
|
"author": "R. A. Salvatore"
|
||||||
|
},{
|
||||||
|
"title": "Deltora Quest #6",
|
||||||
|
"author": "Emily Rodda"
|
||||||
|
},{
|
||||||
|
"title": "Boundless",
|
||||||
|
"author": "R. A. Salvatore"
|
||||||
|
},{
|
||||||
|
"title": "Deltora Quest #3",
|
||||||
|
"author": "Emily Rodda"
|
||||||
|
},{
|
||||||
|
"title": "Shadowmoor. anthology",
|
||||||
|
"author": "Digitized by the Internet Archive"
|
||||||
|
},{
|
||||||
|
"title": "Twilight",
|
||||||
|
"author": "Christie Golden"
|
||||||
|
},{
|
||||||
|
"title": "Dragon Age",
|
||||||
|
"author": "Patrick Weekes"
|
||||||
|
},{
|
||||||
|
"title": "Deltora Quest #7",
|
||||||
|
"author": "Emily Rodda"
|
||||||
|
},{
|
||||||
|
"title": "Streams of Silver",
|
||||||
|
"author": "R. A. Salvatore"
|
||||||
|
},{
|
||||||
|
"title": "Spelling Mississippi ",
|
||||||
|
"author": "Woodrow, Marnie, 1969-"
|
||||||
|
},{
|
||||||
|
"title": "Odyssey",
|
||||||
|
"author": "Vance Moore"
|
||||||
|
},{
|
||||||
|
"title": "Frank Herbert's Dune Saga Collection",
|
||||||
|
"author": "Frank Herbert"
|
||||||
|
},{
|
||||||
|
"title": "Mass Effect",
|
||||||
|
"author": "Catherynne M. Valente"
|
||||||
|
},{
|
||||||
|
"title": "The Demon Soul",
|
||||||
|
"author": "Richard A. Knaak"
|
||||||
|
},{
|
||||||
|
"title": "Sweet Smoke",
|
||||||
|
"author": "Alyson Belle"
|
||||||
|
},{
|
||||||
|
"title": "Magic The Gathering - Masquerade Cycle Book 01 - Mercadian Masques",
|
||||||
|
"author": "Magic The Gathering"
|
||||||
|
},{
|
||||||
|
"title": "Johan (Magic - Legends Cycle I)",
|
||||||
|
"author": "Clayton Emery"
|
||||||
|
},{
|
||||||
|
"title": "Rent girl",
|
||||||
|
"author": "Tea, Michelle"
|
||||||
|
},{
|
||||||
|
"title": "The Subtle Art of Not Giving a F*ck",
|
||||||
|
"author": "Mark Manson"
|
||||||
|
},{
|
||||||
|
"title": "Chainer's Torment",
|
||||||
|
"author": "Scott McGough"
|
||||||
|
},{
|
||||||
|
"title": "Shiver (Junji Ito Selected Stories)",
|
||||||
|
"author": "Junji Ito"
|
||||||
|
},{
|
||||||
|
"title": "Vengeance of the Iron Dwarf",
|
||||||
|
"author": "R. A. Salvatore"
|
||||||
|
},{
|
||||||
|
"title": "Lord of Souls",
|
||||||
|
"author": "Greg Keyes"
|
||||||
|
},{
|
||||||
|
"title": "Starcraft",
|
||||||
|
"author": "Blizzard Entertainment"
|
||||||
|
},{
|
||||||
|
"title": "Lord of the Clans",
|
||||||
|
"author": "Christie Golden"
|
||||||
|
},{
|
||||||
|
"title": "World of Warcraft",
|
||||||
|
"author": "BLIZZARD ENTERTAINMENT"
|
||||||
|
},{
|
||||||
|
"title": "The Chronicles of Narnia Complete 7-Book Collection",
|
||||||
|
"author": "C. S. Lewis"
|
||||||
|
},{
|
||||||
|
"title": "Deltora Quest #5",
|
||||||
|
"author": "Emily Rodda"
|
||||||
|
},{
|
||||||
|
"title": "STARCRAFT II HEAVEN’S DEVILS",
|
||||||
|
"author": "WILLIAM C. DIETZ"
|
||||||
|
},{
|
||||||
|
"title": "Magic The Gathering - Masquerade Cycle Book 01 - Mercadian Masques",
|
||||||
|
"author": "Magic The Gathering"
|
||||||
|
},{
|
||||||
|
"title": "Gauntlgrym",
|
||||||
|
"author": "R.A. Salvatore"
|
||||||
|
},{
|
||||||
|
"title": "The Companions",
|
||||||
|
"author": "R. A. Salvatore"
|
||||||
|
},{
|
||||||
|
"title": "Guardian, Saviors of Kamigawa",
|
||||||
|
"author": "Scott Mcgough"
|
||||||
|
},{
|
||||||
|
"title": "The Shattered Alliance",
|
||||||
|
"author": "Jeff Grubb"
|
||||||
|
},{
|
||||||
|
"title": "The complete stories and poems of Lewis Carroll",
|
||||||
|
"author": "Carroll, Lewis, 1832-1898"
|
||||||
|
},{
|
||||||
|
"title": "Invisible Women",
|
||||||
|
"author": "Caroline Criado Perez"
|
||||||
|
},{
|
||||||
|
"title": "Sojourn",
|
||||||
|
"author": "R.A. Salvatore"
|
||||||
|
},{
|
||||||
|
"title": "Mass Effect",
|
||||||
|
"author": "Karpyshyn, Drew, Dietz, William C."
|
||||||
|
},{
|
||||||
|
"title": "Exile",
|
||||||
|
"author": "R.A. Salvatore"
|
||||||
|
},{
|
||||||
|
"title": "The Fifth Dawn",
|
||||||
|
"author": "Cory Herndon"
|
||||||
|
},{
|
||||||
|
"title": "Deltora Quest #8",
|
||||||
|
"author": "Emily Rodda"
|
||||||
|
},{
|
||||||
|
"title": "Archmage",
|
||||||
|
"author": "R. A. Salvatore"
|
||||||
|
},{
|
||||||
|
"title": "The Pirate King",
|
||||||
|
"author": "R.A. Salvatore"
|
||||||
|
},{
|
||||||
|
"title": "World of Warcraft",
|
||||||
|
"author": "Christie Golden"
|
||||||
|
},{
|
||||||
|
"title": "The Two Swords",
|
||||||
|
"author": "R.A. Salvatore"
|
||||||
|
},{
|
||||||
|
"title": "The Sly Futa Inn",
|
||||||
|
"author": "Chasey, Selena"
|
||||||
|
},{
|
||||||
|
"title": "Shadows Rising (World of Warcraft",
|
||||||
|
"author": "Madeleine Roux"
|
||||||
|
},{
|
||||||
|
"title": "Sylvanas (World of Warcraft)",
|
||||||
|
"author": "Christie Golden"
|
||||||
|
},{
|
||||||
|
"title": "Heretic, Betrayers of Kamigawa",
|
||||||
|
"author": "Scott Mcgough"
|
||||||
|
},{
|
||||||
|
"title": "MANGA",
|
||||||
|
"author": "Internet Archive"
|
||||||
|
},{
|
||||||
|
"title": "Eventide ",
|
||||||
|
"author": "McGough, Scott"
|
||||||
|
},{
|
||||||
|
"title": "Magic The Gathering - Artifact Cycle 02 - Planeswalker",
|
||||||
|
"author": "Magic The Gathering"
|
||||||
|
},{
|
||||||
|
"title": "Yokai Calling",
|
||||||
|
"author": "Erynn Lehtonen"
|
||||||
|
},{
|
||||||
|
"title": "Rise of the Horde",
|
||||||
|
"author": "Christie Golden"
|
||||||
|
},{
|
||||||
|
"title": "Magic The Gathering - Artifact Cycle 04 - Bloodlines",
|
||||||
|
"author": "Magic The Gathering"
|
||||||
|
},{
|
||||||
|
"title": "Flashpoint",
|
||||||
|
"author": "Christie Golden"
|
||||||
|
},{
|
||||||
|
"title": "The Divergent Library",
|
||||||
|
"author": "Roth, Veronica"
|
||||||
|
},{
|
||||||
|
"title": "Magic the Gathering - The Gathering Dark",
|
||||||
|
"author": "Jeff Grubb"
|
||||||
|
},{
|
||||||
|
"title": "Magic The Gathering - Odyssey 01 - Odyssey",
|
||||||
|
"author": "Magic The Gathering"
|
||||||
|
},{
|
||||||
|
"title": "Firstborn",
|
||||||
|
"author": "Christie Golden"
|
||||||
|
},{
|
||||||
|
"title": "Magic The Gathering - Masquerade Cycle Book 03 - Prophecy",
|
||||||
|
"author": "Magic The Gathering"
|
||||||
|
},{
|
||||||
|
"title": "Deltora Quest #1",
|
||||||
|
"author": "Emily Rodda"
|
||||||
|
},{
|
||||||
|
"title": "Magic The Gathering - Invasion Cycle Book 01 - Invasion",
|
||||||
|
"author": "Magic The Gathering"
|
||||||
|
},{
|
||||||
|
"title": "Forgotten Realms",
|
||||||
|
"author": "R. A. Salvatore"
|
||||||
|
},{
|
||||||
|
"title": "The Shattering",
|
||||||
|
"author": "Christie Golden"
|
||||||
|
},{
|
||||||
|
"title": "Before the Storm (World of Warcraft)",
|
||||||
|
"author": "Christie Golden"
|
||||||
|
},{
|
||||||
|
"title": "Time Spiral",
|
||||||
|
"author": "Scott McGough"
|
||||||
|
},{
|
||||||
|
"title": "Will McDermott - Magic the Gathering - Odyssey Cycle 03",
|
||||||
|
"author": "Judgement"
|
||||||
|
},{
|
||||||
|
"title": "Maestro",
|
||||||
|
"author": "R.A. Salvatore"
|
||||||
|
},{
|
||||||
|
"title": "The Spiral Path",
|
||||||
|
"author": "Greg Weisman"
|
||||||
|
},{
|
||||||
|
"title": "Mass Effect",
|
||||||
|
"author": "N.K. Jemisin"
|
||||||
|
},{
|
||||||
|
"title": "Frankenstein",
|
||||||
|
"author": "Ito, Junji"
|
||||||
|
},{
|
||||||
|
"title": "Forgotten Realms",
|
||||||
|
"author": "R. A. Salvatore"
|
||||||
|
},{
|
||||||
|
"title": "The Complete Witcher",
|
||||||
|
"author": "Andrzej Sapkowski"
|
||||||
|
},{
|
||||||
|
"title": "The Sundering",
|
||||||
|
"author": "Richard A. Knaak"
|
||||||
|
},{
|
||||||
|
"title": "The Moons of Mirrodin",
|
||||||
|
"author": "Will McDermott"
|
||||||
|
},{
|
||||||
|
"title": "World of Warcraft",
|
||||||
|
"author": "Unknown Author"
|
||||||
|
},{
|
||||||
|
"title": "Champion's trial",
|
||||||
|
"author": "McGough, Scott"
|
||||||
|
},{
|
||||||
|
"title": "Trans Witch",
|
||||||
|
"author": "E. Chris Garrison, Anne Rosario"
|
||||||
|
},{
|
||||||
|
"title": "House rules",
|
||||||
|
"author": "Digitized by the Internet Archive"
|
||||||
|
},{
|
||||||
|
"title": "Shadow Hunters",
|
||||||
|
"author": "Christie Golden"
|
||||||
|
},{
|
||||||
|
"title": "World of WarCraft - Tides of Darkness",
|
||||||
|
"author": "Aaron Rosenberg"
|
||||||
|
},{
|
||||||
|
"title": "Ravnica",
|
||||||
|
"author": "Cory Herndon"
|
||||||
|
},{
|
||||||
|
"title": "Ghost in the Shell",
|
||||||
|
"author": "James Swallow"
|
||||||
|
},{
|
||||||
|
"title": "Future Sight",
|
||||||
|
"author": "John Delaney"
|
||||||
|
}]
|
117
books/index.html
Normal file
117
books/index.html
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<title>Naomi's Book Library</title>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
|
<meta name="description" content="An interactive explorer for the books Naomi reads." />
|
||||||
|
<script src="https://cdn.nhcarrigan.com/headers/index.js" async defer></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<main>
|
||||||
|
<h1>Naomi's Book Library</h1>
|
||||||
|
<section>
|
||||||
|
<p>An interactive explorer for the books Naomi reads.</p>
|
||||||
|
<p id="count">Loading library...</p>
|
||||||
|
</section>
|
||||||
|
<div style="display: none;">
|
||||||
|
<span>Search Authors: </span>
|
||||||
|
<input type="text" id="author" />
|
||||||
|
</div>
|
||||||
|
<div style="display: none;">
|
||||||
|
<span>Search Titles: </span>
|
||||||
|
<input type="text" id="title" />
|
||||||
|
</div>
|
||||||
|
<div style="display: none;">
|
||||||
|
<button type="button" id="clear">Clear Filters</button>
|
||||||
|
</div>
|
||||||
|
<table id="books">
|
||||||
|
|
||||||
|
</table>
|
||||||
|
</main>
|
||||||
|
</body>
|
||||||
|
<script>
|
||||||
|
const authorQuery = document.getElementById('author');
|
||||||
|
const titleQuery = document.getElementById('title');
|
||||||
|
const resetButton = document.getElementById('clear');
|
||||||
|
const bookTable = document.getElementById('books');
|
||||||
|
const filterBooks = (author, title) => {
|
||||||
|
let result = [...bookList];
|
||||||
|
if(author) {
|
||||||
|
result = result.filter(book => book.author.toLowerCase().includes(author.toLowerCase()));
|
||||||
|
}
|
||||||
|
if(title) {
|
||||||
|
result = result.filter(book => book.title.toLowerCase().includes(title.toLowerCase()));
|
||||||
|
}
|
||||||
|
resetButton.parentElement.style.display = author || title ? "block" : "none";
|
||||||
|
document.getElementById('count').innerText = author || title ? `Filtered to ${result.length} books from ${bookList.length}.` : `Naomi currently has ${bookList.length} books.`;
|
||||||
|
updateTable(result);
|
||||||
|
}
|
||||||
|
const loadBooks = (books) => {
|
||||||
|
bookList.push(...books);
|
||||||
|
authorQuery.value = "";
|
||||||
|
titleQuery.value = "";
|
||||||
|
authorQuery.parentElement.style.display = "block";
|
||||||
|
titleQuery.parentElement.style.display = "block";
|
||||||
|
document.getElementById('count').innerText = `Naomi currently has ${books.length} books.`;
|
||||||
|
updateTable(books);
|
||||||
|
}
|
||||||
|
const updateTable = (books) => {
|
||||||
|
books = books.sort((a, b) => a.title.localeCompare(b.title));
|
||||||
|
bookTable.innerHTML = "";
|
||||||
|
const header = document.createElement('tr');
|
||||||
|
const authorHeader = document.createElement('th');
|
||||||
|
authorHeader.innerText = "Author";
|
||||||
|
const titleHeader = document.createElement('th');
|
||||||
|
titleHeader.innerText = "Title";
|
||||||
|
header.appendChild(titleHeader);
|
||||||
|
header.appendChild(authorHeader);
|
||||||
|
bookTable.appendChild(header);
|
||||||
|
books.forEach(book => {
|
||||||
|
const row = document.createElement('tr');
|
||||||
|
const author = document.createElement('td');
|
||||||
|
author.innerText = book.author;
|
||||||
|
const title = document.createElement('td');
|
||||||
|
title.innerText = book.title;
|
||||||
|
row.appendChild(title);
|
||||||
|
row.appendChild(author);
|
||||||
|
bookTable.appendChild(row);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
const bookList = [];
|
||||||
|
fetch("./books.json").then(res => res.json()).then(data => loadBooks(data))
|
||||||
|
|
||||||
|
authorQuery?.addEventListener("input", (e) => filterBooks(e.target.value, titleQuery.value));
|
||||||
|
titleQuery?.addEventListener("input", (e) => filterBooks(authorQuery.value, e.target.value));
|
||||||
|
resetButton?.addEventListener("click", () => {
|
||||||
|
authorQuery.value = "";
|
||||||
|
titleQuery.value = "";
|
||||||
|
filterBooks("", "");
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<style>
|
||||||
|
table {
|
||||||
|
width: 100%;
|
||||||
|
border-collapse: collapse;
|
||||||
|
}
|
||||||
|
tr:nth-of-type(even) {
|
||||||
|
background-color: #db7093dd;
|
||||||
|
color: #ffefef;
|
||||||
|
}
|
||||||
|
input {
|
||||||
|
background:var(--foreground);
|
||||||
|
color:var(--background);
|
||||||
|
border:1px solid white;
|
||||||
|
border-radius:10px;
|
||||||
|
padding:.25rem
|
||||||
|
}
|
||||||
|
button {
|
||||||
|
background:var(--foreground);
|
||||||
|
color:var(--background);
|
||||||
|
border:1px solid white;
|
||||||
|
border-radius:10px;
|
||||||
|
padding:.25rem;
|
||||||
|
cursor:url('https://cdn.nhcarrigan.com/cursors/pointer.cur'), pointer;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</html>
|
2
songs.sh
2
songs.sh
@ -29,8 +29,6 @@ for file in $(find /home/naomi/music -type f -print0 | tr '\0' '\n'); do
|
|||||||
|
|
||||||
# use jq to add the song to the list
|
# use jq to add the song to the list
|
||||||
songs="$songs$(jq -n --arg title "$title" --arg artist "$artist" '{title: $title, artist: $artist}'),"
|
songs="$songs$(jq -n --arg title "$title" --arg artist "$artist" '{title: $title, artist: $artist}'),"
|
||||||
|
|
||||||
# songs="$songs{\"title\":\"$(echo "$title" | sed -e 's/[\\"\/]/\\&/g' | sed -e 's/[\x01-\x1f\x7f]//g')\",\"artist\":\"$(echo "$artist" | sed -e 's/[\\"\/]/\\&/g' | sed -e 's/[\x01-\x1f\x7f]//g')\"},"
|
|
||||||
done
|
done
|
||||||
|
|
||||||
# Remove trailing comma and add square brackets to complete the list
|
# Remove trailing comma and add square brackets to complete the list
|
||||||
|
2
sync.sh
2
sync.sh
@ -1,6 +1,6 @@
|
|||||||
#! /usr/bin/bash
|
#! /usr/bin/bash
|
||||||
|
|
||||||
dirs=("bsky" "chat" "games" "link-redirector" "resume" "testimonials" "manual" "sitemap" "music");
|
dirs=("bsky" "chat" "games" "link-redirector" "resume" "testimonials" "manual" "sitemap" "music" "books");
|
||||||
|
|
||||||
for dir in "${dirs[@]}"; do
|
for dir in "${dirs[@]}"; do
|
||||||
rsync -av $dir prod:/home/nhcarrigan
|
rsync -av $dir prod:/home/nhcarrigan
|
||||||
|
Loading…
x
Reference in New Issue
Block a user