File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed
Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -35,19 +35,18 @@ def show
3535 private
3636
3737 def convert_shownote ( content )
38- youtube_id = @episode . content . match ( /watch\? v=((\w )*)/ ) [ 1 ]
39-
4038 shownote = <<~HTML
4139 < h2 id ='shownote '>
4240 < a href ='#shownote '> 🎤</ a >
4341 Shownote
4442 < small > (話したこと)</ small >
4543 </ h2 >
4644 HTML
47-
4845 content . gsub! ( /(#+) Shownote/ ) { shownote }
49- return content unless content . match? ( Podcast ::TIMESTAMP_REGEX )
5046
47+ return content unless content . match? ( Podcast ::YOUTUBE_ID_REGEX )
48+ return content unless content . match? ( Podcast ::TIMESTAMP_REGEX )
49+ youtube_id = @episode . content . match ( Podcast ::YOUTUBE_ID_REGEX ) [ 1 ]
5150 content . gsub! ( Podcast ::TIMESTAMP_REGEX ) do
5251 t = $1
5352 t = ( t . size == '0:00' . size ) ? '0' + t : t
Original file line number Diff line number Diff line change @@ -2,7 +2,8 @@ class Podcast < ApplicationRecord
22 self . table_name = 'podcasts'
33 DIR_PATH = 'public/podcasts'
44 WDAY2JAPANESE = %w( 日 月 火 水 木 金 土 )
5- TIMESTAMP_REGEX = /-\s ((\d :)?\d {1,}:\d {2})/
5+ TIMESTAMP_REGEX = /-\s ((\d :)?\d {1,}:\d {2})/
6+ YOUTUBE_ID_REGEX = /watch\? v=((\w )*)/
67
78 validates :title , presence : true
89 validates :content_size , presence : true
You can’t perform that action at this time.
0 commit comments