Skip to content
This repository has been archived by the owner on Mar 9, 2024. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
added iso_639_leecher
git-svn-id: svn://78.47.249.61/ruby-mediawiki/trunk@48 ba9c31aa-a806-0410-9a81-9f13d15ee83b
  • Loading branch information
sven committed Apr 1, 2006
1 parent 066aba0 commit bd06190
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 1 deletion.
41 changes: 41 additions & 0 deletions apps/iso_639_leecher.rb
@@ -0,0 +1,41 @@
#!/usr/bin/env ruby

$:.unshift('../lib')

require 'mediawiki/dotfile'
require 'mediawiki/table'
require 'momomoto/momomoto'
require 'momomoto/tables'
require 'momomoto/bot_login'

ENV['MEDIAWIKI_WIKI'] = 'wikipedia_de'

db_config = YAML.load_file('db_config.yml')['development']
Momomoto::Base.connect(db_config)
Momomoto::Bot_login.authorize('ui_tagger')

wiki = MediaWiki.dotfile
page = wiki.article('ISO 639', 3)
t = MediaWiki::Table.parse( page.text )

t.shift

t.each do | row |
row[2].split( '/' ).each do | iso_code |
id = Momomoto::Language.find({:iso_639_code=>iso_code})
next unless id.length == 1
match = row[0].match /\[\[(.*\|)?(.+)\]\]/
name = match[2]

local = Momomoto::Language_localized.find({:language_id=>id.language_id,:translated_id=>144})
if local.length == 0 && name != ''
local.create
local.language_id = id.language_id
local.translated_id = 144
local.name = name
local.write
end

end
end

4 changes: 3 additions & 1 deletion apps/rdoc_to_wiki.rb
Expand Up @@ -6,6 +6,8 @@
$:.unshift('../lib') $:.unshift('../lib')
require 'mediawiki/dotfile' require 'mediawiki/dotfile'


ENV['MEDIAWIKI_WIKI'] = 'astrobot'



def find(dir, &block) def find(dir, &block)
Dir.foreach(dir) { |file| Dir.foreach(dir) { |file|
Expand Down Expand Up @@ -97,7 +99,7 @@ def wiki_format(flow)
} }
} }


if false # Dry run? if true # Dry run?
puts text puts text
exit exit
end end
Expand Down

0 comments on commit bd06190

Please sign in to comment.