<commit_before>require 'json'

require_relative 'header.rb'

class Metadata

	configfile = File.join(Bkmkr::Paths.project_tmp_dir, "config.json")

	@@file = File.read(configfile)
	@@data_hash = JSON.parse(@@file)

	def self.booktitle
		if @@data_hash['title'].nil? or !@@data_hash['title']
			Bkmkr::Project.filename
		else 
			@@data_hash['title']
		end
	end

	def self.booksubtitle
		if @@data_hash['subtitle'].nil? or !@@data_hash['subtitle']
			"Unknown"
		else 
			@@data_hash['subtitle']
		end
	end

	def self.bookauthor
		if @@data_hash['author'].nil? or !@@data_hash['author']
			"Unknown"
		else 
			@@data_hash['author']
		end
	end

	def self.productid
		if @@data_hash['productid'].nil? or !@@data_hash['productid']
			Bkmkr::Project.filename
		else 
			@@data_hash['productid']
		end
	end

	def self.pisbn
		if @@data_hash['printid'].nil? or !@@data_hash['printid']
			Bkmkr::Project.filename
		else 
			@@data_hash['printid']
		end
	end

	def self.eisbn
		if @@data_hash['ebookid'].nil? or !@@data_hash['ebookid']
			Bkmkr::Project.filename
		else 
			@@data_hash['ebookid']
		end
	end

	def self.imprint
		if @@data_hash['imprint'].nil? or !@@data_hash['imprint']
			"Unknown"
		else 
			@@data_hash['imprint']
		end
	end

	def self.publisher
		if @@data_hash['publisher'].nil? or !@@data_hash['publisher']
			"Unknown"
		else 
			@@data_hash['publisher']
		end
	end

	def self.printcss
		if @@data_hash['printcss'].nil? or !@@data_hash['printcss']
			"none"
		else 
			@@data_hash['printcss']
		end
	end

	def self.printjs
		if @@data_hash['printjs'].nil? or !@@data_hash['printjs']
			"none"
		else 
			@@data_hash['printjs']
		end
	end

	def self.epubcss
		if @@data_hash['ebookcss'].nil? or !@@data_hash['ebookcss']
			"none"
		else 
			@@data_hash['ebookcss']
		end
	end

	def self.frontcover
		if @@data_hash['frontcover'].nil? or !@@data_hash['frontcover']
			"Unknown"<commit_msg>fixing nil values for windows<commit_after>require 'json'

require_relative 'header.rb'

class Metadata

	configfile = File.join(Bkmkr::Paths.project_tmp_dir, "config.json")

	@@file = File.read(configfile)
	@@data_hash = JSON.parse(@@file)

	def self.booktitle
		if @@data_hash['title'].nil? or @@data_hash['title'].empty? or !@@data_hash['title']
			Bkmkr::Project.filename
		else 
			@@data_hash['title']
		end
	end

	def self.booksubtitle
		if @@data_hash['subtitle'].nil? or @@data_hash['subtitle'].empty? or !@@data_hash['subtitle']
			"Unknown"
		else 
			@@data_hash['subtitle']
		end
	end

	def self.bookauthor
		if @@data_hash['author'].nil? or @@data_hash['author'].empty? or !@@data_hash['author']
			"Unknown"
		else 
			@@data_hash['author']
		end
	end

	def self.productid
		if @@data_hash['productid'].nil? or @@data_hash['productid'].empty? or !@@data_hash['productid']
			Bkmkr::Project.filename
		else 
			@@data_hash['productid']
		end
	end

	def self.pisbn
		if @@data_hash['printid'].nil? or @@data_hash['printid'].empty? or !@@data_hash['printid']
			Bkmkr::Project.filename
		else 
			@@data_hash['printid']
		end
	end

	def self.eisbn
		if @@data_hash['ebookid'].nil? or @@data_hash['ebookid'].empty? or !@@data_hash['ebookid']
			Bkmkr::Project.filename
		else 
			@@data_hash['ebookid']
		end
	end

	def self.imprint
		if @@data_hash['imprint'].nil? or @@data_hash['imprint'].empty? or !@@data_hash['imprint']
			"Unknown"
		else 
			@@data_hash['imprint']
		end
	end

	def self.publisher
		if @@data_hash['publisher'].nil? or @@data_hash['publisher'].empty? or !@@data_hash['publisher']
			"Unknown"
		else 
			@@data_hash['publisher']
		end
	end

	def self.printcss
		if @@data_hash['printcss'].nil? or @@data_hash['printcss'].empty? or !@@data_hash['printcss']
			"none"
		else 
			@@data_hash['printcss']
		end
	end

	def self.printjs
		if @@data_hash['printjs'].nil? or @@data_hash['printjs'].empty? or !@@data_hash['printjs']
			"none"
		else 
			@@data_hash['printjs']
		end
	end

	def self.epubcss
		if @@data_hash['ebookcss'].nil? or @@data_hash['ebookcss'].empty? or !@@data_hash['ebookcss']
			"none"
		else 
			@@data_hash['ebookcss']
		end
	end

	def self.frontcover
		if @@data_hash['frontcover'].nil? or @@data_hash['frontcover'].empty? or !@@data_hash['frontcover']
			"Unknown"
{'fraction_non_alphanumeric': 0.17381008761543926, 'fraction_numerical': 0.0, 'mean_word_length': 4.450322580645161, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1018457', 'n_tokens_mistral': 1824, 'n_tokens_neox': 1601, 'n_words': 309}