-
Notifications
You must be signed in to change notification settings - Fork 195
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Create LICENSE.md * media models * Dump 14 * unneeded code * do not add db * Media content in API * submodule update * Time to move surah info into database (#79) * time to move surah info into database * retrun info wrt to language * surah infos * no more tafsir search * Segments and Surah info apis * Upgrade ruby to 2.3.1 * fixed specs and added check for audio availability (#81)
- Loading branch information
Showing
27 changed files
with
251 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,6 @@ | |
config/deploy.rb | ||
vendor/cache | ||
vendor/bundle/ | ||
db/structure.sql | ||
db | ||
dump.rdb | ||
passenger.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ git: | |
submodules: false | ||
|
||
rvm: | ||
- 2.2.3 | ||
- 2.3.1 | ||
|
||
cache: bundler | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2016 Quran.com | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# == Schema Information | ||
# | ||
# Table name: content.surah_infos | ||
# | ||
# id :integer not null, primary key | ||
# language_code :string | ||
# description :text | ||
# surah_id :integer | ||
# content_source :text | ||
# short_description :text | ||
# | ||
|
||
class Content::SurahInfo < ActiveRecord::Base | ||
extend Content | ||
|
||
self.table_name = 'surah_infos' | ||
self.primary_key = 'id' | ||
|
||
belongs_to :language, class_name: 'Locale::Language', foreign_key: 'language_code' | ||
belongs_to :surah, class_name: 'Quran::Surah' | ||
|
||
validates :language, :surah, presence: true | ||
|
||
def as_json(options = {}) | ||
super(options.merge(only: [:language_code, :description, :content_source, :short_description, :surah_id])) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module Media | ||
include Schema | ||
|
||
Schema.schema_name('Media', 'media') | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# == Schema Information | ||
# | ||
# Table name: media.content | ||
# | ||
# resource_id :integer not null, primary key | ||
# ayah_key :string primary key | ||
# url :string | ||
# created_at :datetime not null | ||
# updated_at :datetime not null | ||
# | ||
|
||
class Media::Content < ActiveRecord::Base | ||
extend Media | ||
|
||
self.primary_keys = :resource_id, :ayah_key | ||
|
||
belongs_to :resource, class_name: 'Media::Resource' | ||
belongs_to :ayah, class_name: 'Quran::Ayah', foreign_key: 'ayah_key' | ||
|
||
def as_json(options = {}) | ||
super(include: :resource) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# == Schema Information | ||
# | ||
# Table name: media.resource | ||
# | ||
# resource_id :integer not null, primary key | ||
# name :string | ||
# url :string | ||
# provider :string | ||
# created_at :datetime not null | ||
# updated_at :datetime not null | ||
# | ||
|
||
class Media::Resource < ActiveRecord::Base | ||
extend Media | ||
|
||
has_many :content | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule db
updated
from f15726 to 5dbfe0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# May need this if @cpfair changes the files. | ||
# files = [ | ||
# { recitation_id: 1, filename: 'Abdul_Basit_Mujawwad_128kbps.json' }, | ||
# { recitation_id: 2, filename: 'Abdul_Basit_Murattal_64kbps.json' }, | ||
# { recitation_id: 3, filename: 'Abdurrahmaan_As-Sudais_192kbps.json' }, | ||
# { recitation_id: 4, filename: 'Abu_Bakr_Ash-Shaatree_128kbps.json' }, | ||
# { recitation_id: 5, filename: 'Hani_Rifai_192kbps.json' }, | ||
# { recitation_id: 7, filename: 'Husary_Muallim_128kbps.json' }, | ||
# { recitation_id: 8, filename: 'Alafasy_128kbps.json' }, | ||
# { recitation_id: 9, filename: 'Minshawy_Mujawwad_192kbps.json' }, | ||
# { recitation_id: 10, filename: 'Minshawy_Murattal_128kbps.json' }, | ||
# { recitation_id: 11, filename: 'Saood_ash-Shuraym_128kbps.json' }, | ||
# { recitation_id: 12, filename: 'Mohammad_al_Tablaway_128kbps.json' }, | ||
# { recitation_id: 13, filename: 'Husary_64kbps.json' }, | ||
# ] | ||
# | ||
# | ||
# Parallel.each(files, in_processes: 4, progress: 'Importing segments') do |file| | ||
# begin | ||
# puts file[:filename] | ||
# json = Oj.load_file("../quran-align-data/#{file[:filename]}") | ||
# audio_files = Audio::File.where(recitation_id: file[:recitation_id], segments: nil) | ||
# | ||
# json.each do |ayah_json| | ||
# record = audio_files.find_by(ayah_key: "#{ayah_json['surah']}:#{ayah_json['ayah']}") | ||
# record.update(segments: ayah_json["segments"], segments_stats: ayah_json["stats"]) | ||
# end | ||
# | ||
# rescue Exception => e | ||
# puts e.message | ||
# puts e.backtrace.inspect | ||
# end | ||
# end |
Oops, something went wrong.