aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/db
diff options
context:
space:
mode:
Diffstat (limited to 'mediagoblin/db')
-rw-r--r--mediagoblin/db/sql/migrations.py14
-rw-r--r--mediagoblin/db/sql/models.py8
2 files changed, 21 insertions, 1 deletions
diff --git a/mediagoblin/db/sql/migrations.py b/mediagoblin/db/sql/migrations.py
index d6b709b2..49798a54 100644
--- a/mediagoblin/db/sql/migrations.py
+++ b/mediagoblin/db/sql/migrations.py
@@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-from sqlalchemy import MetaData, Table, Column, Boolean
+from sqlalchemy import MetaData, Table, Column, Boolean, SmallInteger
from mediagoblin.db.sql.util import RegisterMigration
@@ -47,3 +47,15 @@ def add_wants_notification_column(db_conn):
default=True, nullable=True)
col.create(users, populate_defaults=True)
db_conn.commit()
+
+
+@RegisterMigration(3, MIGRATIONS)
+def add_transcoding_progress(db_conn):
+ metadata = MetaData(bind=db_conn.bind)
+
+ media_entry = Table('core__media_entries', metadata, autoload=True,
+ autoload_with=db_conn.bind)
+
+ col = Column('transcoding_progress', SmallInteger)
+ col.create(media_entry)
+ db_conn.commit()
diff --git a/mediagoblin/db/sql/models.py b/mediagoblin/db/sql/models.py
index 9815fcf9..6ce4e06f 100644
--- a/mediagoblin/db/sql/models.py
+++ b/mediagoblin/db/sql/models.py
@@ -107,6 +107,8 @@ class MediaEntry(Base, MediaEntryMixin):
fail_error = Column(Unicode)
fail_metadata = Column(JSONEncoded)
+ transcoding_progress = Column(SmallInteger)
+
queued_media_file = Column(PathTupleWithSlashes)
queued_task_id = Column(Unicode)
@@ -209,6 +211,12 @@ class MediaEntry(Base, MediaEntryMixin):
__import__(models_module)
return sys.modules[models_module].DATA_MODEL
+ def __repr__(self):
+ return '<{classname} {id}: {title}>'.format(
+ classname=self.__class__.__name__,
+ id=self.id,
+ title=self.title)
+
class FileKeynames(Base):
"""