mirror of
https://github.com/jlu5/SupyPlugins.git
synced 2025-04-30 07:21:12 -05:00
accountsdb: always save files into the data directory
This commit is contained in:
parent
3c23e0e319
commit
c0d15face0
@ -1,11 +1,11 @@
|
|||||||
# Autogenerated by update-modules.py on Sun Dec 30 13:09:36 2018 - DO NOT EDIT THIS COPY DIRECTLY!
|
# Autogenerated by update-modules.py on Sun Dec 30 14:20:44 2018 - DO NOT EDIT THIS COPY DIRECTLY!
|
||||||
"""
|
"""
|
||||||
Shared code for database handling.
|
Shared code for database handling.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import pickle
|
import pickle
|
||||||
|
|
||||||
from supybot import ircdb, log
|
from supybot import ircdb, log, conf
|
||||||
|
|
||||||
class AccountsDB():
|
class AccountsDB():
|
||||||
"""
|
"""
|
||||||
@ -22,7 +22,7 @@ class AccountsDB():
|
|||||||
"""
|
"""
|
||||||
self.db = {}
|
self.db = {}
|
||||||
self._plugin_name = plugin_name
|
self._plugin_name = plugin_name
|
||||||
self.filename = filename
|
self.filename = conf.supybot.directories.data.dirize(filename)
|
||||||
try:
|
try:
|
||||||
with open(self.filename, 'rb') as f:
|
with open(self.filename, 'rb') as f:
|
||||||
self.db = pickle.load(f)
|
self.db = pickle.load(f)
|
||||||
|
@ -51,7 +51,7 @@ class LastFM(callbacks.Plugin):
|
|||||||
def __init__(self, irc):
|
def __init__(self, irc):
|
||||||
self.__parent = super(LastFM, self)
|
self.__parent = super(LastFM, self)
|
||||||
self.__parent.__init__(irc)
|
self.__parent.__init__(irc)
|
||||||
self.db = accountsdb.AccountsDB("LastFM", filename)
|
self.db = accountsdb.AccountsDB("LastFM", "LastFM.db")
|
||||||
world.flushers.append(self.db.flush)
|
world.flushers.append(self.db.flush)
|
||||||
|
|
||||||
# 2.0 API (see http://www.lastfm.de/api/intro)
|
# 2.0 API (see http://www.lastfm.de/api/intro)
|
||||||
@ -212,8 +212,6 @@ class LastFM(callbacks.Plugin):
|
|||||||
irc.reply("%(id)s (realname: %(realname)s) registered on %(registered)s; age: %(age)s; gender: %(gender)s; "
|
irc.reply("%(id)s (realname: %(realname)s) registered on %(registered)s; age: %(age)s; gender: %(gender)s; "
|
||||||
"Country: %(country)s; Tracks played: %(playcount)s" % profile)
|
"Country: %(country)s; Tracks played: %(playcount)s" % profile)
|
||||||
|
|
||||||
filename = conf.supybot.directories.data.dirize("LastFM.db")
|
|
||||||
|
|
||||||
Class = LastFM
|
Class = LastFM
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
# Autogenerated by update-modules.py on Sun Dec 30 13:09:36 2018 - DO NOT EDIT THIS COPY DIRECTLY!
|
# Autogenerated by update-modules.py on Sun Dec 30 14:20:44 2018 - DO NOT EDIT THIS COPY DIRECTLY!
|
||||||
"""
|
"""
|
||||||
Shared code for database handling.
|
Shared code for database handling.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import pickle
|
import pickle
|
||||||
|
|
||||||
from supybot import ircdb, log
|
from supybot import ircdb, log, conf
|
||||||
|
|
||||||
class AccountsDB():
|
class AccountsDB():
|
||||||
"""
|
"""
|
||||||
@ -22,7 +22,7 @@ class AccountsDB():
|
|||||||
"""
|
"""
|
||||||
self.db = {}
|
self.db = {}
|
||||||
self._plugin_name = plugin_name
|
self._plugin_name = plugin_name
|
||||||
self.filename = filename
|
self.filename = conf.supybot.directories.data.dirize(filename)
|
||||||
try:
|
try:
|
||||||
with open(self.filename, 'rb') as f:
|
with open(self.filename, 'rb') as f:
|
||||||
self.db = pickle.load(f)
|
self.db = pickle.load(f)
|
||||||
|
@ -4,7 +4,7 @@ Shared code for database handling.
|
|||||||
|
|
||||||
import pickle
|
import pickle
|
||||||
|
|
||||||
from supybot import ircdb, log
|
from supybot import ircdb, log, conf
|
||||||
|
|
||||||
class AccountsDB():
|
class AccountsDB():
|
||||||
"""
|
"""
|
||||||
@ -21,7 +21,7 @@ class AccountsDB():
|
|||||||
"""
|
"""
|
||||||
self.db = {}
|
self.db = {}
|
||||||
self._plugin_name = plugin_name
|
self._plugin_name = plugin_name
|
||||||
self.filename = filename
|
self.filename = conf.supybot.directories.data.dirize(filename)
|
||||||
try:
|
try:
|
||||||
with open(self.filename, 'rb') as f:
|
with open(self.filename, 'rb') as f:
|
||||||
self.db = pickle.load(f)
|
self.db = pickle.load(f)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user