Merge lp:~j-corwin/openlp/migration into lp:openlp
- migration
- Merge into trunk
Status: | Superseded |
---|---|
Proposed branch: | lp:~j-corwin/openlp/migration |
Merge into: | lp:openlp |
Diff against target: | None lines |
To merge this branch: | bzr merge lp:~j-corwin/openlp/migration |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Raoul Snyman | Needs Fixing | ||
Review via email: mp+6124@code.launchpad.net |
This proposal has been superseded by a proposal from 2009-05-02.
Commit message
Description of the change
Jonathan Corwin (j-corwin) wrote : | # |
Raoul Snyman (raoul-snyman) wrote : | # |
Muhahaha! The Style Police has arrived!
(Yes, this is mostly old code, but it needs to be said!)
All strings are single-quoted and unicode:
self.
should be:
self.
Why are you adding columns one at a time?
conn.
conn.commit()
self.
conn.
conn.commit()
self.
conn.
conn.commit()
Shouldn't that rather be:
conn.execute("""
create table authors (
id integer primary key ASC AUTOINCREMENT,
first_name varchar(128),
last_name varchar(128),
display_name varchar(255)
);""")
conn.commit()
self.
Also name variables better:
# I'm not sure what these two variables are supposed to be
def run_cmd(self, cmd):
f_i, f_o = os.popen4(cmd)
Jonathan Corwin (j-corwin) wrote : | # |
On Sat, May 2, 2009 at 9:31 PM, Raoul Snyman <
<email address hidden>> wrote:
> Review: Needs Fixing
> Muhahaha! The Style Police has arrived!
>
> (Yes, this is mostly old code, but it needs to be said!)
>
> All strings are single-quoted and unicode:
>
> self.display.
>
> should be:
>
> self.display.
Was already there, nowt to do with me
>
> Why are you adding columns one at a time?
>
> conn.execute(
> AUTOINCREMENT);""")
> conn.commit()
> self.display.
> conn.execute(
> varchar(128);""")
> conn.commit()
> self.display.
> conn.execute(
> conn.commit()
>
> Shouldn't that rather be:
> conn.execute("""
> create table authors (
> id integer primary key ASC AUTOINCREMENT,
> first_name varchar(128),
> last_name varchar(128),
> display_name varchar(255)
> );""")
> conn.commit()
> self.display.
I agree, but again was just copying what was already there since I didn't
know if the original author had done it that way on purpose
>
> Also name variables better:
>
> # I'm not sure what these two variables are supposed to be
> def run_cmd(self, cmd):
> f_i, f_o = os.popen4(cmd)
I didn't touch this function and have no idea what it does.
All I was doing was updating existing code so it worked... I wasn't planning
on rewriting the whole existing
module.
Jonathan Corwin (j-corwin) wrote : | # |
> Muhahaha! The Style Police has arrived!
Changes pushed.
- 439. By Raoul Snyman
-
Added images
- 440. By Raoul Snyman
-
Merged Jonathan Corwin's changes to the database migration script.
- 441. By Tim Bentley
-
Start adding serviceitem code and SlideController code.
Fix some Theme bugs as well - 442. By Raoul Snyman
-
Added slide images.
- 443. By Tim Bentley
-
Various fixes and more additions of SlideController stuff
Add ButtonBar for SlideControllers - 444. By Tim Bentley
-
<email address hidden>
- 445. By Tim Bentley
-
<email address hidden>
- 446. By Tim Bentley
-
<email address hidden>
- 447. By Tim Bentley
-
<email address hidden>
- 448. By Tim Bentley
-
<email address hidden>
- 449. By Tim Bentley
-
<email address hidden>
- 450. By Tim Bentley
-
fix copyright symbol error
- 451. By Raoul Snyman
-
Changed the SlideController to look MUCH nicer.
- 452. By Tim Bentley
-
<email address hidden>
- 453. By Raoul Snyman
-
A number of style cleanups.
- 454. By Tim Bentley
-
Fix Cancel bug on BibleImport screen
Fix odi error on PresentationDialog - 455. By Raoul Snyman
-
Merged config changes into trunk.
- 456. By Tim Bentley
-
<email address hidden>
- 457. By Tim Bentley
-
Fix crash
- 458. By Tim Bentley
-
<email address hidden>
- 459. By Raoul Snyman
-
Merged proposal #7122
- 460. By Raoul Snyman
-
Removed erroneous "show"ing of the display form.
- 461. By Tim Bentley
-
Fix bible bugs and make fomatting corrections
- 462. By Raoul Snyman
-
Split ServiceManager toolbar into 2 parts, resized docks to a smaller size again thanks to narrower ServiceManager.
- 463. By Tim Bentley
-
Add OOS and speed up Renderer
- 464. By Raoul Snyman
-
Pulling in QImage changes from renderer branch
- 465. By Tim Bentley
-
add OOS code and speed up renderer
Add re-theming in servicemanager when theme changes.
Sort out Renderer to prevent not relevent calls - 466. By Tim Bentley
-
Songs plugin phase 1 complete
- 467. By Tim Bentley
-
Finish the cleanup of Songs.
- 468. By Tim Bentley
-
Mass Unicode conversion.
- 469. By Tim Bentley
-
ode cleanups from last merge and Bible Custom changes
Remove 2.6 deprication - 470. By Tim Bentley
-
ServiceManager changes
Small bug fixes
New OOS format - 471. By Tim Bentley
-
OOS now works with Images , Bibles, Songs and Custom
Fixes to Bible plugin and clean up of Images
Mennu fixes - 472. By Tim Bentley
-
Change default Unicode handling
- 473. By Tim Bentley
-
Page Up/Down works on SlideController
Search for Authors on Songs now work - 474. By Raoul Snyman
-
Merged changed keyboard events.
- 475. By Tim Bentley
-
Fix error on Song Saving
- 476. By Tim Bentley
-
Various fixes and addition of song migation code
- 477. By Martin Thompson
-
Merged media manager refactoring
- 478. By Raoul Snyman
-
Merged Andrew Lok's video tests into trunk
- 479. By Raoul Snyman
-
Merged assert fixes.
- 480. By Tim Bentley
-
Plugable slide controllers
Start of OpenOffice Plugin.
Bug fixes - 481. By Tim Bentley
-
fixups to mediamanager
Bug fixes
Plugable Toolbar - 482. By Tim Bentley
-
Martins mediaItem Changes
SlideController rewrite
Plugable SlideControllerBars
Bug fixes
Better Rendering size - 483. By Tim Bentley
-
Remove unused stuff
Add more bits to ImageSlideController bar
Clean up ThemeManager
Add OOS saving - 484. By Raoul Snyman
-
Fixed up a few logging things, a few bits of indentation, and resolved some conflicts from the last update.
- 485. By Raoul Snyman
-
Merged changes to Bible plugin into trunk.
- 486. By Raoul Snyman
-
Put the settings tab back in after accidentally removing it... silly me!
- 487. By Raoul Snyman
-
Merged docstrings changes.
- 488. By Raoul Snyman
-
Merging from docstrings branch.
- 489. By Tim Bentley
-
Cleanups
Plugin slidepreviers
documentatation
removal of old files - 490. By Raoul Snyman
-
Removing built documentation - this is not needed, we only need to store the documentation source files in version control.
- 491. By Raoul Snyman
-
Added ignore status to directories in the documentation's build directory.
- 492. By Tim Bentley
-
Bug fixes from the wiki
- 493. By Tim Bentley
-
Various bug fixes and code improvements.
- 494. By Raoul Snyman
-
Merged in the changes from the biblefixes branch.
- 495. By Tim Bentley
-
Fix song editing so it works
Added now images for Song editors
Fix up Alert code so now works. - 496. By Tim Bentley
-
Fix up song dialog errors
Fix servicemanager key entry
Fix servicemanager state handling - 497. By Raoul Snyman
-
Merged in changes from the songmaintenance branch
- 498. By Raoul Snyman
-
Merged in some changes for the song maintenance form.
- 499. By Tim Bentley
-
New features and fixes.
- 500. By Tim Bentley
-
Bug fixes from last merge
- 501. By Raoul Snyman
-
Merged in changes from my song maintenance branch.
- 502. By Raoul Snyman
-
Merge from songmaintenance branch.
- 503. By Tim Bentley
-
New bible Import Screen
Transparent Theme backgrounds
Global Theme Handling improvements-------This line and the following will be ignored --------------
modified:
openlp/core/lib/ renderer. py
openlp/core/lib/ themexmlhandler .py
openlp/core/ui/ amendthemeform. py
openlp/core/ui/ servicemanager. py
openlp/core/ui/ thememanager. py
openlp/core/ui/ themestab. py
openlp/plugins/ bibles/ forms/bibleimpo rtdialog. py
resources/forms/bibleimpo rtdialog. ui
pending merges:
Tim Bentley 2009-08-07 finish Theme handling corrections
Tim Bentley 2009-08-07 Default handling allows editing and blocks deletes
Tim Bentley 2009-08-07 New bible import form
Tim Bentley 2009-08-06 [merge] Head
Tim Bentley 2009-08-06 Standardize row hight in renderer - 504. By Tim Bentley
-
Lets save songs now
- 505. By Raoul Snyman
-
Merge from bugfixes
- 506. By Tim Bentley
-
Remote pluging
EventManager Fixes
Cleanups
Renderer Performance improvements - 507. By Tim Bentley
-
Updates
- 508. By Tim Bentley
-
Lets put the bracket in the correct place
- 509. By Tim Bentley
-
Plugin Screen added
Presentation Plugin started
Remotes now configurable - 510. By Tim Bentley
-
Many fixes and corrections
Adding Presentation code (start)
Add error message to code - 511. By Tim Bentley
-
SlideController clean up
Image Plugin Cleanup - 512. By Tim Bentley
-
Clean up Event Processing
- 513. By Jon Tibble
-
Committing Jon Tibble's merge proposal.
- 514. By Maikel Stuivenberg
-
Merged in lp:~maikels/openlp/myfixes
- 515. By Tim Bentley
-
Sort out SlideController
- 516. By Tim Bentley
-
Various changes see loog for details
- 517. By Jon Tibble
-
Merge for John
- 518. By Jon Tibble
-
Merge for Jon
- 519. By Tim Bentley
-
Performance Improvements and code fixes
- 520. By Raoul Snyman
-
Merge from lp:~raoul-snyman/openlp/songmaintenance
- 521. By Jon Tibble
-
Merged in lp:~meths/openlp/trivialfixes
- 522. By Tim Bentley
-
New features and fixes
- 523. By Tim Bentley
-
Add Next slide to Presentations
Start with settings manager - 524. By Raoul Snyman
-
Merged lp:~raoul-snyman/openlp/docstrings into trunk.
- 525. By Jon Tibble
-
Latest merge from lp:~meths/openlp/trivialfixes
- 526. By Tim Bentley
-
Various changes
- 527. By Jon Tibble
-
For Jon
- 528. By Tim Bentley
-
Song and Custom cleanups
- 529. By Jon Tibble
-
For Jon
- 530. By Raoul Snyman
-
Merged changes in from lp:~raoul-snyman/openlp/songmaintenance
- 531. By Jon Tibble
-
Merged in lp:~meths/openlp/trivialfixes
- 532. By Raoul Snyman
-
Merged in lp:~raoul-snyman/openlp/docstrings
- 533. By Jon Tibble
-
Merged in lp:~meths/openlp/trivialfixes
- 534. By Jon Tibble
-
For Jon
Fix themes - 535. By Jon Tibble
-
For Jon
Fix themes 2 - 536. By Jon Tibble
-
For Jon
- 537. By Raoul Snyman
-
Merge from lp:~raoul-snyman/openlp/bugfixes
- 538. By Tim Bentley
-
Updates to Presentations etc
- 539. By Maikel Stuivenberg
-
For Maikel
- 540. By Tim Bentley
-
Themes and Timer points
- 541. By Tim Bentley
-
Fix merge error
- 542. By Jon Tibble
-
For Jon
- 543. By Tim Bentley
-
Renderer handling changes
- 544. By Jon Tibble
-
Merged in lp:~meths/openlp/trivialfixes
- 545. By Jon Tibble
-
For Jon
- 546. By Jon Tibble
-
For Jon
- 547. By Jonathan Corwin
-
for jonathan
- 548. By Tim Bentley
-
presentation fixes
- 549. By Tim Bentley
-
Correction from == to is
- 550. By Jon Tibble
-
Merge log.exception() conversion
- 551. By Tim Bentley
-
Arrival of the Audit
- 552. By Tim Bentley
-
Plugin cleanup
- 553. By Maikel Stuivenberg
-
Menu changes
- 554. By Jon Tibble
-
Dock Widget Refactoring
- 555. By Jon Tibble
-
Fix service loading on Windows
- 556. By Tim Bentley
-
Audit Fixes
- 557. By Jon Tibble
-
Refactor services
- 558. By Jon Tibble
-
Cleanup code and fixes
- 559. By Tim Bentley
-
Renderer Fixes
- 560. By Raoul Snyman
-
Merged in lp:~raoul-snyman/openlp/bugfixes
- 561. By Tim Bentley
-
rendering fixes
- 562. By Jon Tibble
-
Song editor fixes
- 563. By Jon Tibble
-
Coding Standards
- 564. By Tim Bentley
-
Best merge ever
- 565. By Tim Bentley
-
Audit changes and clean up
- 566. By Jonathan Corwin
-
Merge from lp:~j-corwin/openlp/presentations
- 567. By Jon Tibble
-
Code clean ups
- 568. By Tim Bentley
-
Audit Changes to database
- 569. By Jonathan Corwin
-
Merge from lp:~j-corwin/openlp/presentations
- 570. By Jon Tibble
-
PPTViewer fixes
- 571. By Jon Tibble
-
Imports clean up
- 572. By Tim Bentley
-
Plugin changes to Audit, Song and Custom
- 573. By Jon Tibble
-
None testing and clean ups
- 574. By Tim Bentley
-
Plugin updates
- 575. By Jonathan Corwin
-
Jons Presentation merge with hack to fix conflicts
- 576. By Tim Bentley
-
Audit changes and cleanups
- 577. By Jonathan Corwin
-
Presentation merge with gotos
- 578. By Jon Tibble
-
Fix presentation starting
- 579. By Jon Tibble
-
Use buildIcon and fixes
- 580. By Tim Bentley
-
Style cleanups
- 581. By Jonathan Corwin
-
Presentations made it at last
- 582. By Jonathan Corwin
-
Presentation dll
- 583. By Tim Bentley
-
Start of about Text
- 584. By Jon Tibble
-
Dialogs, Exceptions and Toolbars
- 585. By Tim Bentley
-
Update PluginList Window
- 586. By Jonathan Corwin
-
Presentation updates
- 587. By Tim Bentley
-
Add Ability to hide plugins
- 588. By Jonathan Corwin
-
More Presentation improvements
- 589. By Tim Bentley
-
More hiding code changes
- 590. By Tim Bentley
-
Fix song issue
- 591. By Jon Tibble
-
Presentation cleanups
- 592. By Jon Tibble
-
Bible rendering fixes
- 593. By Tim Bentley
-
Apply fixes for Jon
- 594. By Raoul Snyman
-
Merged in lp:~raoul-snyman/openlp/pluginlist
- 595. By Tim Bentley
-
Plugin hinding comes to town
- 596. By Jonathan Corwin
-
More Presentation fixes
- 597. By Tim Bentley
-
Various changes and fixes
- 598. By Jonathan Corwin
-
TLC for the asv
- 599. By Raoul Snyman
-
Merged in lp:~raoul-snyman/openlp/versionfix
- 600. By Tim Bentley
-
Add Web Bibles to Advanced Tab and other nice features
- 601. By Jonathan Corwin
-
Presentation changes
- 602. By Tim Bentley
-
Update config files for deployment
- 603. By Jonathan Corwin
-
Windows/Linux sqlite2 -> sqlite3 migration in one step
- 604. By Jonathan Corwin
-
Fix code standard issues. Remove redundant modules
- 605. By Jonathan Corwin
-
Head
- 606. By Jonathan Corwin
-
Bible migration
- 607. By Jonathan Corwin
-
Head
- 608. By Jonathan Corwin
-
Bible migration
- 609. By Jonathan Corwin
-
Commit verses at end
- 610. By Jonathan Corwin
-
Head
- 611. By Jonathan Corwin
-
Commented out two lines without realising it. I blame Noah
Unmerged revisions
Preview Diff
1 | === modified file 'openlp/migration/migratesongs.py' | |||
2 | --- openlp/migration/migratesongs.py 2009-02-04 20:16:56 +0000 | |||
3 | +++ openlp/migration/migratesongs.py 2009-05-02 19:32:15 +0000 | |||
4 | @@ -48,10 +48,10 @@ | |||
5 | 48 | print self.database_files | 48 | print self.database_files |
6 | 49 | 49 | ||
7 | 50 | def process(self): | 50 | def process(self): |
9 | 51 | self.display.output("Songs processing started"); | 51 | self.display.output("Songs processing started") |
10 | 52 | for f in self.database_files: | 52 | for f in self.database_files: |
11 | 53 | self.v_1_9_0(f) | 53 | self.v_1_9_0(f) |
13 | 54 | self.display.output("Songs processing finished"); | 54 | self.display.output("Songs processing finished") |
14 | 55 | 55 | ||
15 | 56 | def v_1_9_0(self, database): | 56 | def v_1_9_0(self, database): |
16 | 57 | self.display.output("Migration 1.9.0 Started for "+database); | 57 | self.display.output("Migration 1.9.0 Started for "+database); |
17 | @@ -61,83 +61,69 @@ | |||
18 | 61 | self._v1_9_0_songauthors(database) | 61 | self._v1_9_0_songauthors(database) |
19 | 62 | self._v1_9_0_songtopics(database) | 62 | self._v1_9_0_songtopics(database) |
20 | 63 | self._v1_9_0_songs(database) | 63 | self._v1_9_0_songs(database) |
24 | 64 | self._v1_9_0_songs_update(database) | 64 | self.display.output("Migration 1.9.0 Finished for " + database) |
22 | 65 | |||
23 | 66 | self.display.output("Migration 1.9.0 Finished for " + database); | ||
25 | 67 | 65 | ||
26 | 68 | def _v1_9_0_authors(self, database): | 66 | def _v1_9_0_authors(self, database): |
28 | 69 | self.display.sub_output("Authors Started for "+database); | 67 | self.display.sub_output("Authors Started for "+database) |
29 | 70 | conn = sqlite3.connect(self.data_path+os.sep+database) | 68 | conn = sqlite3.connect(self.data_path+os.sep+database) |
30 | 71 | conn.execute("""alter table authors rename to authors_temp;""") | 69 | conn.execute("""alter table authors rename to authors_temp;""") |
31 | 72 | conn.commit() | 70 | conn.commit() |
34 | 73 | 71 | conn.execute("""create table authors (id integer primary key ASC AUTOINCREMENT);""") | |
33 | 74 | conn.execute("""create table authors add column display_name varchar(255);""") | ||
35 | 75 | conn.commit() | 72 | conn.commit() |
37 | 76 | self.display.sub_output("first name created") | 73 | self.display.sub_output("authors table created") |
38 | 77 | conn.execute("""alter table authors add column first_name varchar(128);""") | 74 | conn.execute("""alter table authors add column first_name varchar(128);""") |
39 | 78 | conn.commit() | 75 | conn.commit() |
41 | 79 | self.display.sub_output("first name created") | 76 | self.display.sub_output("first_name added") |
42 | 80 | conn.execute("""alter table authors add column last_name varchar(128);""") | 77 | conn.execute("""alter table authors add column last_name varchar(128);""") |
43 | 81 | conn.commit() | 78 | conn.commit() |
46 | 82 | self.display.sub_output("last name created") | 79 | self.display.sub_output("last_name added") |
47 | 83 | conn.execute("""create index if not exists author_display_name on authors (display_name ASC,id ASC);""") | 80 | conn.execute("""alter table authors add column display_name varchar(255);""") |
48 | 81 | conn.commit() | ||
49 | 82 | self.display.sub_output("display_name added") | ||
50 | 83 | conn.execute("""create index if not exists author1 on authors (display_name ASC,id ASC);""") | ||
51 | 84 | conn.commit() | 84 | conn.commit() |
52 | 85 | self.display.sub_output("index author1 created") | 85 | self.display.sub_output("index author1 created") |
54 | 86 | conn.execute("""create index if not exists author_last_name on authors (last_name ASC,id ASC);""") | 86 | conn.execute("""create index if not exists author2 on authors (last_name ASC,id ASC);""") |
55 | 87 | conn.commit() | 87 | conn.commit() |
56 | 88 | self.display.sub_output("index author2 created") | 88 | self.display.sub_output("index author2 created") |
58 | 89 | conn.execute("""create index if not exists author_first_name on authors (first_name ASC,id ASC);""") | 89 | conn.execute("""create index if not exists author3 on authors (first_name ASC,id ASC);""") |
59 | 90 | conn.commit() | 90 | conn.commit() |
60 | 91 | self.display.sub_output("index author3 created") | 91 | self.display.sub_output("index author3 created") |
61 | 92 | self.display.sub_output("Author Data Migration started") | 92 | self.display.sub_output("Author Data Migration started") |
64 | 93 | c = conn.cursor() | 93 | conn.execute("""insert into authors (id, display_name) select authorid, authorname from authors_temp;""") |
65 | 94 | text = c.execute("""select * from authors """) .fetchall() | 94 | conn.commit() |
66 | 95 | self.display.sub_output("authors populated") | ||
67 | 96 | c = conn.cursor() | ||
68 | 97 | text = c.execute("""select * from authors""") .fetchall() | ||
69 | 95 | for author in text: | 98 | for author in text: |
83 | 96 | dispname = author[1] | 99 | dispname = author[3] |
84 | 97 | if author[2] == None: | 100 | dispname = dispname.replace("'", "") # remove quotes. |
85 | 98 | dispname = dispname.replace("'", "") # remove quotes. | 101 | pos = dispname.rfind(" ") |
86 | 99 | pos = dispname.rfind(" ") | 102 | afn = dispname[:pos] |
87 | 100 | afn = dispname[:pos] | 103 | aln = dispname[pos + 1:len(dispname)] |
88 | 101 | aln = dispname[pos + 1:len(dispname)] | 104 | s = "update authors set first_name = '" \ |
89 | 102 | #txt = text[2] | 105 | + afn + "', last_name = '" + aln + "' where id = " + str(author[0]) |
90 | 103 | s = "update authors set display_name = '" + dispname + "', first_name = '" + afn + "', last_name = '" + aln + "' where id = " +str(author[0]) | 106 | text1 = c.execute(s) |
91 | 104 | text1 = c.execute(s) | 107 | conn.commit() |
79 | 105 | conn.commit() | ||
80 | 106 | conn.execute("""alter table authors drop column authorname;""") | ||
81 | 107 | conn.commit() | ||
82 | 108 | conn.close() | ||
92 | 109 | self.display.sub_output("Author Data Migration Completed") | 108 | self.display.sub_output("Author Data Migration Completed") |
106 | 110 | self.display.sub_output("Authors Completed"); | 109 | conn.execute("""drop table authors_temp;""") |
94 | 111 | |||
95 | 112 | def _v1_9_0_topics(self, database): | ||
96 | 113 | self.display.sub_output("Topics Started for "+database); | ||
97 | 114 | conn = sqlite3.connect(self.data_path+os.sep+database) | ||
98 | 115 | conn.text_factory = str | ||
99 | 116 | conn.execute("""create table if not exists topics (id integer Primary Key ASC AUTOINCREMENT);""") | ||
100 | 117 | conn.commit() | ||
101 | 118 | self.display.sub_output("Topic table created") | ||
102 | 119 | conn.execute("""alter table topics add column name varchar(128);""") | ||
103 | 120 | conn.commit() | ||
104 | 121 | self.display.sub_output("topicname added") | ||
105 | 122 | conn.execute("""create index if not exists topic1 on topics (name ASC,id ASC);""") | ||
107 | 123 | conn.commit() | 110 | conn.commit() |
108 | 124 | conn.close() | 111 | conn.close() |
112 | 125 | self.display.sub_output("index topic1 created") | 112 | self.display.sub_output("author_temp dropped") |
113 | 126 | 113 | self.display.sub_output("Authors Completed") | |
111 | 127 | self.display.sub_output("Topics Completed"); | ||
114 | 128 | 114 | ||
115 | 129 | def _v1_9_0_songbook(self, database): | 115 | def _v1_9_0_songbook(self, database): |
117 | 130 | self.display.sub_output("SongBook Started for "+database); | 116 | self.display.sub_output("SongBook Started for "+database) |
118 | 131 | conn = sqlite3.connect(self.data_path+os.sep+database) | 117 | conn = sqlite3.connect(self.data_path+os.sep+database) |
119 | 132 | conn.execute("""create table if not exists song_books (id integer Primary Key ASC AUTOINCREMENT);""") | 118 | conn.execute("""create table if not exists song_books (id integer Primary Key ASC AUTOINCREMENT);""") |
120 | 133 | conn.commit() | 119 | conn.commit() |
121 | 134 | self.display.sub_output("SongBook table created") | 120 | self.display.sub_output("SongBook table created") |
122 | 135 | conn.execute("""alter table song_books add column name varchar(128);""") | 121 | conn.execute("""alter table song_books add column name varchar(128);""") |
123 | 136 | conn.commit() | 122 | conn.commit() |
125 | 137 | self.display.sub_output("songbook_name added") | 123 | self.display.sub_output("songbook name added") |
126 | 138 | conn.execute("""alter table song_books add column publisher varchar(128);""") | 124 | conn.execute("""alter table song_books add column publisher varchar(128);""") |
127 | 139 | conn.commit() | 125 | conn.commit() |
129 | 140 | self.display.sub_output("songbook_publisher added") | 126 | self.display.sub_output("songbook publisher added") |
130 | 141 | conn.execute("""create index if not exists songbook1 on song_books (name ASC,id ASC);""") | 127 | conn.execute("""create index if not exists songbook1 on song_books (name ASC,id ASC);""") |
131 | 142 | conn.commit() | 128 | conn.commit() |
132 | 143 | self.display.sub_output("index songbook1 created") | 129 | self.display.sub_output("index songbook1 created") |
133 | @@ -145,45 +131,31 @@ | |||
134 | 145 | conn.commit() | 131 | conn.commit() |
135 | 146 | conn.close() | 132 | conn.close() |
136 | 147 | self.display.sub_output("index songbook2 created") | 133 | self.display.sub_output("index songbook2 created") |
166 | 148 | self.display.sub_output("SongBook Completed"); | 134 | self.display.sub_output("SongBook Completed") |
138 | 149 | |||
139 | 150 | def _v1_9_0_songtopics(self, database): | ||
140 | 151 | self.display.sub_output("Songtopics Started for "+database); | ||
141 | 152 | conn = sqlite3.connect(self.data_path+os.sep+database) | ||
142 | 153 | conn.execute("""create table if not exists song_topics (song_id integer Primary Key ASC );""") | ||
143 | 154 | conn.commit() | ||
144 | 155 | self.display.sub_output("Songtopics table created") | ||
145 | 156 | conn.execute("""alter table song_topics add column topic_id interger;""") | ||
146 | 157 | conn.commit() | ||
147 | 158 | self.display.sub_output("songtopics_topic_id added") | ||
148 | 159 | conn.execute("""create index if not exists songtopic1 on song_topics (topic_id ASC,song_id ASC);""") | ||
149 | 160 | conn.commit() | ||
150 | 161 | self.display.sub_output("index songbook1 created") | ||
151 | 162 | conn.execute("""create index if not exists songbook2 on song_topics (song_id ASC,topic_id ASC);""") | ||
152 | 163 | conn.commit() | ||
153 | 164 | conn.close() | ||
154 | 165 | self.display.sub_output("index songbook2 created") | ||
155 | 166 | self.display.sub_output("SongTopics Completed"); | ||
156 | 167 | |||
157 | 168 | def _v1_9_0_songauthors(self, database): | ||
158 | 169 | self.display.sub_output("SongAuthors Started for "+database); | ||
159 | 170 | conn = sqlite3.connect(self.data_path+os.sep+database) | ||
160 | 171 | conn.execute("""alter table songauthors rename to authors_songs;""") | ||
161 | 172 | conn.commit() | ||
162 | 173 | conn.close() | ||
163 | 174 | self.display.sub_output("Table Renamed") | ||
164 | 175 | self.display.sub_output("SongAuthors Completed"); | ||
165 | 176 | |||
167 | 177 | 135 | ||
168 | 178 | def _v1_9_0_songs(self, database): | 136 | def _v1_9_0_songs(self, database): |
170 | 179 | self.display.sub_output("Songs Started for "+database); | 137 | self.display.sub_output("Songs Started for "+database) |
171 | 180 | conn = sqlite3.connect(self.data_path+os.sep+database) | 138 | conn = sqlite3.connect(self.data_path+os.sep+database) |
175 | 181 | conn.execute("""alter table songs add column song_book_id interger;""") | 139 | conn.execute("""alter table songs rename to songs_temp;""") |
176 | 182 | conn.commit() | 140 | conn.commit() |
177 | 183 | self.display.sub_output("songs_song_book_id added") | 141 | conn.execute("""create table if not exists songs (id integer Primary Key ASC AUTOINCREMENT);""") |
178 | 142 | conn.commit() | ||
179 | 143 | self.display.sub_output("songs table created") | ||
180 | 144 | conn.execute("""alter table songs add column song_book_id integer;""") | ||
181 | 145 | conn.commit() | ||
182 | 146 | self.display.sub_output("songs song_book_id added") | ||
183 | 147 | conn.execute("""alter table songs add title varchar(255);""") | ||
184 | 148 | conn.commit() | ||
185 | 149 | self.display.sub_output("songs title added") | ||
186 | 150 | conn.execute("""alter table songs add lyrics text;""") | ||
187 | 151 | conn.commit() | ||
188 | 152 | self.display.sub_output("songs lyrics added") | ||
189 | 184 | conn.execute("""alter table songs add column verse_order varchar(128);""") | 153 | conn.execute("""alter table songs add column verse_order varchar(128);""") |
190 | 185 | conn.commit() | 154 | conn.commit() |
191 | 186 | self.display.sub_output("songs verse_order added") | 155 | self.display.sub_output("songs verse_order added") |
192 | 156 | conn.execute("""alter table songs add copyright varchar(255);""") | ||
193 | 157 | conn.commit() | ||
194 | 158 | self.display.sub_output("songs copyright added") | ||
195 | 187 | conn.execute("""alter table songs add column comments text;""") | 159 | conn.execute("""alter table songs add column comments text;""") |
196 | 188 | conn.commit() | 160 | conn.commit() |
197 | 189 | self.display.sub_output("songs comments added") | 161 | self.display.sub_output("songs comments added") |
198 | @@ -208,50 +180,75 @@ | |||
199 | 208 | self.display.sub_output("index songs1 created") | 180 | self.display.sub_output("index songs1 created") |
200 | 209 | conn.execute("""create index if not exists songs2 on songs (search_title ASC,id ASC);""") | 181 | conn.execute("""create index if not exists songs2 on songs (search_title ASC,id ASC);""") |
201 | 210 | conn.commit() | 182 | conn.commit() |
202 | 211 | conn.close() | ||
203 | 212 | self.display.sub_output("index songs2 created") | 183 | self.display.sub_output("index songs2 created") |
246 | 213 | self.display.sub_output("Songs Completed"); | 184 | |
247 | 214 | 185 | conn.execute("""insert into songs (id, title, lyrics, copyright, search_title, search_lyrics, song_book_id) | |
248 | 215 | 186 | select songid, songtitle, lyrics, copyrightinfo, | |
249 | 216 | 187 | replace(replace(replace(replace(replace(replace(replace(replace(replace(songtitle, '&', 'and'), ',', ''), ';', ''), ':', ''), '(', ''), ')', ''), '{', ''), '}',''),'?',''), | |
250 | 217 | def _v1_9_0_songs_update(self, database): | 188 | replace(replace(replace(replace(replace(replace(replace(replace(replace(lyrics, '&', 'and'), ',', ''), ';', ''), ':', ''), '(', ''), ')', ''), '{', ''), '}',''),'?',''), |
251 | 218 | self.display.sub_output("Songs Started for "+database); | 189 | 0 |
252 | 219 | self.db = create_engine("sqlite:///"+self.data_path+os.sep+database, encoding='utf-8' , convert_unicode=False, assert_unicode=False) | 190 | from songs_temp;""") |
253 | 220 | 191 | ||
254 | 221 | self.db.echo = True | 192 | conn.commit() |
255 | 222 | metadata.bind = self.db | 193 | self.display.sub_output("songs populated") |
256 | 223 | metadata.bind.echo = False | 194 | conn.execute("""drop table songs_temp;""") |
257 | 224 | Session = scoped_session(sessionmaker(autoflush=True, autocommit=False)) | 195 | conn.commit() |
258 | 225 | Session.configure(bind=self.db) | 196 | conn.close() |
259 | 226 | #create missing table | 197 | self.display.sub_output("songs_temp dropped") |
260 | 227 | songs_topics_table.create() | 198 | |
261 | 228 | songs = Session.query(Song).all() | 199 | self.display.sub_output("Songs Completed") |
262 | 229 | for song in songs: | 200 | |
263 | 230 | t=song.title.replace("&", "and") | 201 | def _v1_9_0_topics(self, database): |
264 | 231 | t=t.replace("'", "") | 202 | self.display.sub_output("Topics Started for "+database) |
265 | 232 | t=t.replace(",", "") | 203 | conn = sqlite3.connect(self.data_path+os.sep+database) |
266 | 233 | t=t.replace(";", "") | 204 | conn.text_factory = str |
267 | 234 | t=t.replace(":", "") | 205 | conn.execute("""create table if not exists topics (id integer Primary Key ASC AUTOINCREMENT);""") |
268 | 235 | t=t.replace("(", "") | 206 | conn.commit() |
269 | 236 | t=t.replace(")", "") | 207 | self.display.sub_output("Topic table created") |
270 | 237 | t=t.replace("{", "") | 208 | conn.execute("""alter table topics add column name varchar(128);""") |
271 | 238 | t=t.replace("}", "") | 209 | conn.commit() |
272 | 239 | t=t.replace("?", "") | 210 | self.display.sub_output("topicname added") |
273 | 240 | song.search_title = t | 211 | conn.execute("""create index if not exists topic1 on topics (name ASC,id ASC);""") |
274 | 241 | t=song.lyrics.replace("&", "and") | 212 | conn.commit() |
275 | 242 | t=t.replace("'", "") | 213 | conn.close() |
276 | 243 | t=t.replace(",", "") | 214 | self.display.sub_output("index topic1 created") |
277 | 244 | t=t.replace(";", "") | 215 | |
278 | 245 | t=t.replace(":", "") | 216 | self.display.sub_output("Topics Completed") |
279 | 246 | t=t.replace("(", "") | 217 | |
280 | 247 | t=t.replace(")", "") | 218 | def _v1_9_0_songauthors(self, database): |
281 | 248 | t=t.replace("{", "") | 219 | self.display.sub_output("SongAuthors Started for "+database); |
282 | 249 | t=t.replace("}", "") | 220 | conn = sqlite3.connect(self.data_path+os.sep+database) |
283 | 250 | t=t.replace("?", "") | 221 | conn.execute("""create table if not exists authors_songs (author_id integer);""") |
284 | 251 | song.search_lyrics = t | 222 | conn.commit() |
285 | 252 | song.song_book_id = 0 | 223 | self.display.sub_output("authors_songs table created") |
286 | 253 | Session.save_or_update(song) | 224 | conn.execute("""alter table authors_songs add column song_id integer;""") |
287 | 254 | Session.commit() | 225 | conn.commit() |
288 | 226 | conn.execute("""insert into authors_songs (author_id, song_id) select authorid, songid from songauthors;""") | ||
289 | 227 | conn.commit() | ||
290 | 228 | self.display.sub_output("authors_songs populated") | ||
291 | 229 | conn.execute("""drop table songauthors;""") | ||
292 | 230 | conn.commit() | ||
293 | 231 | self.display.sub_output("songauthors dropped") | ||
294 | 232 | conn.close() | ||
295 | 233 | self.display.sub_output("SongAuthors Completed") | ||
296 | 234 | |||
297 | 235 | def _v1_9_0_songtopics(self, database): | ||
298 | 236 | self.display.sub_output("Songtopics Started for "+database); | ||
299 | 237 | conn = sqlite3.connect(self.data_path+os.sep+database) | ||
300 | 238 | conn.execute("""create table if not exists song_topics (song_id integer);""") | ||
301 | 239 | conn.commit() | ||
302 | 240 | self.display.sub_output("Songtopics table created") | ||
303 | 241 | conn.execute("""alter table song_topics add column topic_id integer;""") | ||
304 | 242 | conn.commit() | ||
305 | 243 | self.display.sub_output("songtopics_topic_id added") | ||
306 | 244 | conn.execute("""create index if not exists songtopic1 on song_topics (topic_id ASC,song_id ASC);""") | ||
307 | 245 | conn.commit() | ||
308 | 246 | self.display.sub_output("index songtopic1 created") | ||
309 | 247 | conn.execute("""create index if not exists songtopic2 on song_topics (song_id ASC,topic_id ASC);""") | ||
310 | 248 | conn.commit() | ||
311 | 249 | conn.close() | ||
312 | 250 | self.display.sub_output("index songtopic2 created") | ||
313 | 251 | self.display.sub_output("SongTopics Completed") | ||
314 | 255 | 252 | ||
315 | 256 | def run_cmd(self, cmd): | 253 | def run_cmd(self, cmd): |
316 | 257 | f_i, f_o = os.popen4(cmd) | 254 | f_i, f_o = os.popen4(cmd) |
317 | 258 | 255 | ||
318 | === modified file 'openlpcnv.pyw' (properties changed: -x to +x) |
Attempt to fix song migration so it matches current file definitions.
Remove the need to edit the dmp file as part of the migration